Advertisement
radostina92

Untitled

May 9th, 2020
137
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.63 KB | None | 0 0
  1. using System;
  2.  
  3. namespace MultiplyBy2
  4. {
  5.     class MultiplyBy2
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.  
  10.             double num = 0;
  11.             while (true)
  12.             {
  13.                 num = double.Parse(Console.ReadLine());
  14.                 if (num >= 0)
  15.                 {
  16.                     double result = num * 2;
  17.                     Console.WriteLine($"Result: {result:f2}");
  18.                 }
  19.                  else if (num < 0)
  20.                 {
  21.                     Console.WriteLine("Negative number!");
  22.                     break;
  23.                 }
  24.                
  25.             }
  26.         }
  27.     }
  28. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement