Beta Coder

Learn code like Beta Coder.

Breaking

Tuesday, September 15, 2020

C Program to Show the use of conditional operator

Show the use of conditional operator

Show the use of conditional operator
In this program we learn how to use of conditional operator in C.
C program to use of conditional operator
// Use of conditional operator
// In this program we check greater number of two numbers by using condition operator
#include<stdio.h>
#include<conio.h>
void main()
{
	int a, b;
	clrscr();
	printf("\n Enter the value for a & b : ");
	scanf("%d%d",&a,&b);
	(a > b) ? printf("\n a is greater") : printf("\n b is greater");
	getch();
}
OUTPUT:
   Enter the value for a & b : 6 9
   b is greater

No comments:

Post a Comment