thegrudge

OddOrEvenIntegers

Nov 11th, 2014
232
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.72 KB | None | 0 0
  1. using System;
  2. class OddOrEvenIntegers
  3. {
  4.     static void Main()
  5.     {
  6.         int n1 = 3;
  7.         int n2 = 2;
  8.         int n3 = -2;
  9.         int n4 = -1;
  10.         int n5 = 0;
  11.         Console.WriteLine((Math.Abs(n1) % 2 == 1) ? n1 + " is it Odd? - True" : n1 + " is it Odd - False");
  12.         Console.WriteLine((Math.Abs(n2) % 2 == 1) ? n2 + " is it Odd? - True" : n2 + " is it Odd - False");
  13.         Console.WriteLine((Math.Abs(n3) % 2 == 1) ? n3 + " is it Odd? - True" : n3 + " is it Odd - False");
  14.         Console.WriteLine((Math.Abs(n4) % 2 == 1) ? n4 + " is it Odd? - True" : n4 + " is it Odd - False");
  15.         Console.WriteLine((Math.Abs(n5) % 2 == 1) ? n5 + " is it Odd? - True" : n5 + " is it Odd - False");
  16.     }
  17. }
Advertisement
Add Comment
Please, Sign In to add comment