Guest User

Untitled

a guest
May 21st, 2018
127
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.33 KB | None | 0 0
  1.             int a = int.Parse(Console.ReadLine());
  2.             double x=0,d=0;
  3.             while (a>0)
  4.             {
  5.                 if (a%10 > 0)
  6.                 {
  7.                     x = x + Math.Pow(2, d);
  8.                 }
  9.                 d++;
  10.                 a = a / 10;
  11.             }
  12.             Console.WriteLine(x);
Add Comment
Please, Sign In to add comment