//Program
# include <stdio.h>
void main()
{
int n;
printf("Enter any integer value : ");
scanf("%d",&n);
if(n%2==0)
{
printf("number is even");
}
else
{
printf("number is odd");
}
}
// EVEN ODD using ternary operator
# include <stdio.h>
void main()
{
int n;
printf("Enter any integer value : ");
scanf("%d",&n);
(n%2==0)?printf("number is even"):printf("number is odd");
}
No comments:
Post a Comment
Note: only a member of this blog may post a comment.