Advertisement
Dilyana86

Untitled

May 27th, 2017
358
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.56 KB | None | 0 0
  1. using System;
  2.  
  3. namespace cSharpIntro
  4. {
  5.     public class program
  6.     {
  7.         public static void Main()
  8.         {
  9.             int num = 0;
  10.             do
  11.             {
  12.                 num = int.Parse(Console.ReadLine());
  13.                 if (num % 2 != 0)
  14.                 {
  15.                     break;
  16.                 }
  17.                 Console.WriteLine("Please write an odd number.");
  18.                 num = int.Parse(Console.ReadLine());
  19.  
  20.             } while (true);
  21.  
  22.             Console.WriteLine("The number is: {0}",Math.Abs(num));
  23.         }
  24.     }
  25. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement