Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System.Runtime.CompilerServices;
- namespace INFINIT
- {
- class program
- {
- static string answ1, answ2; //Entered numbers by the user
- static char[] charArr1; //Entered numbers char arrays
- static char[] charArr2; //Entered numbers char arrays
- static void Main()
- {
- Start();
- }
- static void Start()
- {
- Introduction();
- getNumbers();
- stringToChar1();
- stringToChar2();
- printNumber(charArr1);
- printNumber(charArr2);
- }
- static void Introduction()
- {
- Console.WriteLine("Hello. This is an INFINIT program.");
- Console.WriteLine("You will have to enter 2 numbers, that are larger than int or long datatype. ");
- Console.WriteLine("Int (- 2 147 483 648 : 2 147 483 647)");
- Console.WriteLine("Long (-9 223 372 036 854 775 808 : 9 223 372 036 854 775 807)");
- Console.WriteLine();
- }
- static void getNumbers()
- {
- Console.Write("Enter the first number: ");
- answ1 = Console.ReadLine();
- Console.WriteLine();
- Console.Write("Enter the second number: ");
- answ2 = Console.ReadLine();
- }
- static void stringToChar1()
- {
- charArr1 = new char[answ1.Length];
- charArr1 = answ1.ToCharArray();
- }
- static void stringToChar2()
- {
- charArr2 = new char[answ2.Length];
- charArr2 = answ2.ToCharArray();
- }
- static void printNumber(char[]arr)
- {
- int index=arr.Length-1;
- Console.WriteLine("Presented in the powers of 10: ");
- for (int i = 0; i < arr.Length; i++)
- {
- if(i+1==arr.Length)
- Console.Write($"{arr[i]}*10^{index--} ");
- else if (arr.Length > i + 1)
- Console.Write($"{arr[i]}*10^{index--} + ");
- }
- Console.WriteLine();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment