Advertisement
Guest User

MultiplyBy2

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