Question
Check a Person is Eligible to Vote or not using ternary operator
Solution
β Verified
#include <stdio.h>
int main() {
int age;
printf("Enter your age: ");
scanf("%d", &age);
(age >= 18) ? printf("You are Eligible.\n") : printf("You are Not Eligible.\n");
return 0;
}
Click here to download practice questions on
Ternary Operator