Advertisement
Guest User

Untitled

a guest
Feb 20th, 2020
91
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.  
  3. namespace Metric_Converter
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. double num = double.Parse(Console.ReadLine());
  10. string input = (Console.ReadLine());
  11. string output = (Console.ReadLine());
  12.  
  13. double convert = 0;
  14.  
  15. if (input == "m" && output == "cm")
  16. {
  17. convert= num * 100;
  18. }
  19. else if (input == "cm" && output == "m")
  20. {
  21. convert = num / 100;
  22. }
  23. else if (input =="cm" && output == "mm")
  24. {
  25. convert=num * 10;
  26. }
  27. else if (input =="mm" && output=="cm")
  28. {
  29. convert=num / 10;
  30. }
  31. else if (input=="m" && output=="mm")
  32. {
  33. convert=num * 1000;
  34. }
  35. else if (input=="mm" && output=="m")
  36. {
  37. convert=num/1000;
  38. }
  39. Console.WriteLine($"{convert:F3}");
  40. }
  41. }
  42. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement