Largest value of two variables – Conditional Operator

Largest value of two variables - Conditional Operator

Welcome to the World of Online Learning:

Hello Friends “This blog helps you to learn C programming concepts. You can learn C language at your own speed and time. One can learn concepts of C language by practicing various programs given on various pages of this blog. Enjoy the power of Self-learning using the Internet.”

Largest value of two variables - Conditional Operator
Largest value of two variables – Conditional Operator

Write a C program to Largest value of two variables – Conditional Operator

PROGRAM: Largest value of two variables – Conditional Operator

/*    Find largest value between two variables – single line – Conditional Operator  */

#include<stdio.h>
int main()
{
 int a,b,d;

 printf(“Type values of A and B : “);
 scanf(“%d %d”,&a,&b);
 d=(a>=b?a:b);
 printf(“Greatest value : %d”,d);
 return 0;
}

Leave a Reply

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