Write a C program to accept all character(A to Z) 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

1240

Program:

#include<stdio.h>
void main()
{ 
int i;
for(i=65; i<91; i++)
	{
	(i%2 == 0) ? printf("\n[%c] => This is Even",i) : printf("\n[%c] => This is Odd",i) ;
	}
}

Output:

[A] => This is Odd
[B] => This is Even
[C] => This is Odd
[D] => This is Even
[E] => This is Odd
[F] => This is Even
[G] => This is Odd
[H] => This is Even
[I] => This is Odd
[J] => This is Even
[K] => This is Odd
[L] => This is Even
[M] => This is Odd
[N] => This is Even
[O] => This is Odd
[P] => This is Even
[Q] => This is Odd
[R] => This is Even
[S] => This is Odd
[T] => This is Even
[U] => This is Odd
[V] => This is Even
[W] => This is Odd
[X] => This is Even
[Y] => This is Odd
[Z] => This is EvenPress 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.