Advertisement
imprisoned_mindz

EvenNumber

Sep 20th, 2019
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.57 KB | None | 0 0
  1. using System;
  2.  
  3. namespace EvenNumber
  4. {
  5.     class Program
  6.     {
  7.         static void Main(string[] args)
  8.         {
  9.             int number = int.Parse(Console.ReadLine());
  10.            
  11.  
  12.             while (true)
  13.             {
  14.                 if (number % 2 == 0)
  15.                 {
  16.                     Console.WriteLine("The number is: {0}", Math.Abs(number));
  17.                     break;
  18.                 }
  19.                 Console.WriteLine("Please write an even number.");
  20.                 number = int.Parse(Console.ReadLine());
  21.             }
  22.         }
  23.     }
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement