Advertisement
dragonbs

Even Number

Jan 13th, 2023
80
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.23 KB | None | 0 0
  1. while (true)
  2. {
  3.     int number = int.Parse(Console.ReadLine());
  4.  
  5.     if (number % 2 == 0)
  6.     {
  7.         Console.WriteLine($"The number is: {Math.Abs(number)}");
  8.         break;
  9.     }
  10.     else
  11.     {
  12.         Console.WriteLine($"Please write an even number.");
  13.     }
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement