Advertisement
blazarow09

Untitled

Apr 25th, 2018
75
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.87 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApplication261
  8. {
  9. class Program
  10. {
  11. static void Main(string[] args)
  12. {
  13. var n = (Console.ReadLine());
  14. if (int.Parse(n) % 2 == 0)
  15. {
  16. Console.WriteLine("Even number entered: {0}", n);
  17. return;
  18. }
  19. else
  20. {
  21. while (int.Parse(n) % 2 != 0)
  22. {
  23. n = Console.ReadLine();
  24. Console.WriteLine("Invalid number!");
  25.  
  26. if (int.Parse(n) % 2 == 0)
  27. {
  28. Console.WriteLine("Even number entered: {0}", n);
  29. }
  30. }
  31. }
  32. }
  33. }
  34. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement