Advertisement
Guest User

Untitled

a guest
Mar 23rd, 2019
1,420
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.08 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4.  
  5. namespace _05.Multiply_Big_Number
  6. {
  7. class Program
  8. {
  9. static void Main(string[] args)
  10. {
  11. string bigNumString = Console.ReadLine();
  12. bigNumString= bigNumString.TrimStart(new char[] {'0'});
  13. char[] bigNum = bigNumString.ToCharArray();
  14. int number = int.Parse(Console.ReadLine());
  15. if (number == 0)
  16. {
  17. Console.WriteLine("0");
  18. return;
  19. }
  20. List<string> newNum = new List<string>();
  21.  
  22. int parse = 0;
  23. for (int i = bigNum.Length - 1; i >= 0; i--)
  24. {
  25. parse = (int.Parse(Convert.ToString(bigNum[i])) * number)+parse;
  26. newNum.Insert(0,(parse % 10).ToString());
  27. parse /= 10;
  28. }
  29.  
  30.  
  31. if (parse>0)
  32. Console.WriteLine($"{parse}{string.Join("",newNum)}");
  33. else
  34. Console.WriteLine($"{string.Join("",newNum)}");
  35. }
  36. }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement