sahajjain01

12.Input a number and check if it's even or odd.

Aug 16th, 2015
222
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.33 KB | None | 0 0
  1. //Program to input a number and check if it's even or odd.
  2. #include<stdio.h>
  3. #include<conio.h>
  4.  
  5. void main()
  6. {
  7.     int number;
  8.  
  9.     clrscr();
  10.  
  11.     printf("Enter a number: ");
  12.     scanf("%d", &number);
  13.  
  14.     if(number % 2 == 0)
  15.         printf("The number %d is even.", number);
  16.     else
  17.         printf("The number %d is odd.", number);
  18.  
  19.     getch();
  20. }
Advertisement
Add Comment
Please, Sign In to add comment