//Program to check whether the entered number is even or odd using Modulo Operator
#include<stdio.h>
#include<conio.h>
void main()
{
int number;
clrscr();
printf("\nEnter any integer value\n");
scanf("%d",&number);
//%(Modulo Operator) gives us the remainder
if ( number%2 == 0 )
printf("%d is an Even Number\n",number);
else
printf("%d is an Odd Number\n",number);
getch();
}
#include<stdio.h>
#include<conio.h>
void main()
{
int number;
clrscr();
printf("\nEnter any integer value\n");
scanf("%d",&number);
//%(Modulo Operator) gives us the remainder
if ( number%2 == 0 )
printf("%d is an Even Number\n",number);
else
printf("%d is an Odd Number\n",number);
getch();
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.