Advertisement
Guest User

Untitled

a guest
Sep 16th, 2019
108
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.45 KB | None | 0 0
  1. using System;
  2.  
  3. namespace Four_bit_binary_to_denary
  4. {
  5. class Program
  6. {
  7. public static void Main(string[] args)
  8. {
  9. int answer = 0;
  10. int column = 8;
  11.  
  12. while (column >= 1) {
  13. Console.WriteLine("Enter bit value: ");
  14. int bit = Int32.Parse(Console.ReadLine());
  15. answer = answer + (column * bit);
  16. column = column/2;
  17. }
  18.  
  19. Console.WriteLine("Decimal value is: {0}", answer);
  20. Console.ReadKey(true);
  21. }
  22. }
  23. }|
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement