Advertisement
Gesh4o

FormattingNumbers

Sep 2nd, 2015
92
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.93 KB | None | 0 0
  1. using System;
  2.  
  3. class FormattingNumbers
  4. {
  5. static void Main()
  6. {
  7. {
  8. System.Threading.Thread.CurrentThread.CurrentCulture = System.Globalization.CultureInfo.InvariantCulture;
  9. while (true)
  10. {
  11. Console.WriteLine("Please Insert three numbers: ");
  12. string firstNumber = Console.ReadLine();
  13. int a = int.Parse(firstNumber);
  14. if (a < 0 || a > 500)
  15. {
  16. Console.WriteLine("Invalid Input!");
  17. }
  18. }
  19. int numberA1 = a;
  20. float b = float.Parse(Console.ReadLine());
  21. float c = float.Parse(Console.ReadLine());
  22. string binaryB = Convert.ToString(a, 2);
  23. int binary = int.Parse(binaryB);
  24. Console.WriteLine("|{0,-10:X}|{1:0000000000}|{2,10:.##}|{3,-10:f3}|", a, binary, b, c);
  25.  
  26. }
  27. }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement