Advertisement
pupesko

SoftUni - 5.1 Odd or Even Integers

Oct 10th, 2015
103
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.45 KB | None | 0 0
  1. //Write an expression that checks if given integer is odd or even.
  2.  
  3. using System;
  4.  
  5. class OddEven
  6. {
  7.     static void Main()
  8.     {
  9.         Console.Write("Enter number: ");
  10.         string a = Console.ReadLine();
  11.         int odd = int.Parse(a);
  12.        
  13.         if (odd % 2 == 0)
  14.             {
  15.                Console.WriteLine("false");
  16.             }
  17.             else
  18.             {
  19.                 Console.WriteLine("true");
  20.             }
  21.  
  22.     }
  23. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement