Write a C program to accept a character and check it is even or odd place using the ternary operator (A is an odd place and B is in the even place)

C Programming Language Operators and Enums in C Language (Article) Operators and Enums in C Language (Program)

871

Program:

#include<stdio.h>
#include<conio.h>
int main()
{ 
    char a;
    printf("\n Enter the char: ");
    scanf("%c",&a);
    a%2==0?printf("\n[%c]=>theis is even \n",a):printf("\n[%c]=>theis is odd \n",a);
    return 0;
}

Output:

 Enter the char: A

[A]=>theis is odd
Press any key to continue . . .

Explanation:

nOPE

This Particular section is dedicated to Programs only. If you want learn more about C Programming Language. Then you can visit below links to get more depth on this subject.