VelizarAvramov

12. Even Number

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