Advertisement
KrasenPenev

metric

Jan 20th, 2020
153
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.25 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 Metric_Converter
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. double numForTransformation = double.Parse(Console.ReadLine());
  14. string inputValue = Console.ReadLine();
  15. string outputValue = Console.ReadLine();
  16.  
  17. double velueCm = 0;
  18.  
  19. if (inputValue=="mm")
  20. {
  21. velueCm = numForTransformation / 10;
  22. }
  23. else if (inputValue=="cm")
  24. {
  25. velueCm = numForTransformation * 1;
  26. }
  27. else if (inputValue=="m")
  28. {
  29. velueCm = numForTransformation *100.00;
  30. }
  31. double mirrorVelue = 0;
  32.  
  33. if (outputValue=="mm")
  34. {
  35. mirrorVelue = velueCm * 10;
  36. }
  37. else if (outputValue=="m")
  38. {
  39. mirrorVelue = velueCm / 100;
  40. }
  41. else if (outputValue=="cm")
  42. {
  43. mirrorVelue = velueCm * 1;
  44. }
  45.  
  46. Console.WriteLine($"{mirrorVelue:F3}");
  47. }
  48. }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement