ahmed0saber

Even or Odd in C#

Nov 21st, 2020
38
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.28 KB | None | 0 0
  1. using System;
  2. namespace EvenOrOdd
  3. {
  4. class Project1
  5. {
  6. void Main()
  7. {
  8. int x;
  9. Console.Write("Enter a number : ");
  10. x=Convert.ToInt32(Console.ReadLine());
  11. if(x%2==0){
  12.     Console.Write("number {0} is an even number",x);
  13. }else{
  14.     Console.Write("number {0} is an odd number",x);
  15. }
  16. }
  17. }
  18. }
Advertisement
Add Comment
Please, Sign In to add comment