GerganaTsirkova

OddNumber

Jan 26th, 2018
185
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. using System;
  2.  
  3. namespace OddNumber
  4. {
  5. class Program
  6. {
  7. static void Main(string[] args)
  8. {
  9. int num;
  10. int counter = 0;
  11. while (true)
  12. {
  13. num = int.Parse(Console.ReadLine());
  14. num = Math.Abs(num);
  15. if (num % 2 == 0)
  16. {
  17. Console.WriteLine("Please write an odd number.");
  18. counter++;
  19. if (counter>=10)
  20. {
  21. break;
  22. }
  23. }
  24. else
  25. {
  26. Console.WriteLine("The number is: {0}",num);
  27. break;
  28. }
  29. }
  30. }
  31. }
  32. }
Advertisement
Add Comment
Please, Sign In to add comment