c- program to check weather a number is odd or even
In this program , we will now taking input form the user and check weather the number is even or odd in c-programming.
If the number is divisible by 2 is called even number and if the number is not divisible by 2 is called odd number . In the If condition ,if (n%2==0) then condition is ture so print the even number otherwise condition is false than print odd .
#incude<stdio.h>
#include<conio.h>
main()
{
int x;
printf("enter a number");
scanf("%d",&x);
if(x%2==0)
printf("%d is even number",x);
else
printf("%d is odd number",x);
getch();
}
output:- enter a number x=24
even number
For more c-programming example:-
.c-program to calculate the sum of the two numbers
No comments:
Post a Comment