Advertisement
Terziyski

Odd Number

May 27th, 2017
253
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.44 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 = int.Parse(Console.ReadLine());
  10.  
  11.             while (num % 2 == 0)
  12.             {
  13.                 num = int.Parse(Console.ReadLine());
  14.                 Console.WriteLine("Please write an odd number.");
  15.  
  16.             }
  17.  
  18.             Console.WriteLine($"The number is: {Math.Abs(num)}");
  19.         }
  20.     }
  21. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement