snow

Blogger Widgets

To find the Number is odd or even


/*gowrikausalya.blogspot.com*/
/*c-program to find whether the given number is odd or even */

#include<stdio.h>
#include<conio.h>
int main()
{
    int num;
    printf("Enter the number:\n");
    scanf("%d",&num);
    /*find the modulus of a number*/
    if(num % 2== 1)
           printf("The number is odd");
    else
           printf("The number is even");
    getch();    
}

the program displays the following ouptut:-

Enter the number:
24
The number is even

Enter the number:
13
The number is odd

output screen for easy understanding:-

output screen for even number

output screen for odd number verification

1 comment: