top of page
Search

Write a C Program to Check Odd or Even Using Conditional Operator?




Write a C Program to Check Odd or Even Using Conditional Operator?

#include <stdio.h>

int main()

{

int number;

printf("Enter an integer: ");

scanf("%d", &number);

(number % 2 == 0) ? printf("%d is even.", number) : printf("%d is odd.", number);

return 0;

}


For Video Explanations Check Out Our Playlist on Youtube HERE.


11 views
bottom of page