Advertisement
Guest User

Untitled

a guest
Jun 19th, 2018
82
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.38 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace Задача_4_практика
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. int osn= 2;
  14. int step = 200;
  15. string buf = "2";
  16. string buf2 = "";
  17. char c =' ';
  18. int k, a, b, len;
  19. for(int i=0;i<step;i++)
  20. {
  21. buf2 = buf;
  22. len = buf2.Length;
  23. buf = " ";
  24. k = 0;
  25. for(int j=0;j<len;j++)
  26. {
  27. a= (Convert.ToInt32(buf[j]) ) * osn + k;
  28. b= a %10;
  29. k= a / 10;
  30. buf= buf + Convert.ToChar((int)b+48 );
  31.  
  32. }
  33. if (k != 0)
  34. buf = buf + Convert.ToChar((int)k +48);
  35.  
  36. }
  37. len= buf.Length-1;
  38. for ( int i= 0; i<(len/2); i++)
  39. {
  40. c= buf[len - i ];
  41. buf.Replace(buf[len - i ], buf[i]);
  42. buf.Replace(buf[i], c);
  43. }
  44.  
  45. //Console.WriteLine((buf));
  46. //Console.WriteLine(Convert.ToChar((int)2+48));
  47.  
  48.  
  49.  
  50.  
  51.  
  52.  
  53.  
  54. }
  55. }
  56. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement