C Program To Make Use Of Ternary Operator/Conditional Operator.

Q13. Write a C program to make use of ternary operator/conditional operator.


#include<stdio.h> //standard input/output header file

#include<conio.h> //for clrscr()


int main()


int a,b,c;


clrscr(); //for clearing the screen





c=a>b?a:b; //ternary operator


printf(“\n The value of C is %d.”,c);


getch(); //holds the screen until any key is pressed

return 0; //makes main() finish




The value of C is 15.

Leave a Reply

Your email address will not be published. Required fields are marked *

%d bloggers like this: