Question:
Print “Even” or “Odd” without using a conditional statement
C program:
#include<stdio.h>
int main()
{
int no;
printf("Enter a no: ");
scanf("%d", &no);
(no & 1 && printf("odd"))|| printf("even");
return 0;
}
Output:
Enter a no: 45
odd
0 comments:
Post a Comment