Program to show the use of a conditional operator.

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

1224

Program:

/* Program to show the use of a conditional operator.
  Author: Atnyla Developer */

#include<stdio.h>
#include<conio.h>
void main()
{
  int a, b;
	printf("enter value for a & b: ");
	scanf("%d%d",&a,&b);
	(a>b)?printf("a is greater \n"):printf("b is greater \n");
 
} 

Output:

Output 1 
enter value for a & b: 44  65
b is greater
Press any key to continue . . .


Output 2 
enter value for a & b: 56  12
a is greater
Press any key to continue . . .

Explanation:

Program to show the use of a conditional operator.
	(a>b)?printf("a is greater \n"):printf("b is greater \n");

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.