Find the number is even or odd
Here,the code of finding the number is even or odd.For understand the following code first understand the following topics.
Code:
//this task is to find the number is even or odd ,that is enter by the user
#include <stdio.h>
int main()
{
int a = 0;
printf("Please enter the number\n");
scanf("%d", &a);
if (a % 2 == 0) //it means if the remainder come 0 after dividing by2 ,then it is even otherwise it is odd.
printf("\nThe number is Even.\n");
else
printf("\nThe number is Odd.\n");
getchar;
return 0;
}
Comments
Post a Comment