C program to find largest among three numbers using ternary operator( ?: ).

#include<stdio.h>
#include<conio.h>
int main(){
float a, b, c;
clrscr();
printf("Enter three numbers: ");
scanf("%f %f %f", &a, &b, &c);
(a>b)? if(a>c)? printf("Largest number = %.2f",a): printf("Largest number = %.2f",c): if(b>c) printf("Largest number = %.2f",b): printf("Largest number = %.2f",c);
getch();
return 1;
}

Comments

Popular posts from this blog

C Language Topics in Hindi and English

C language IMP Questions for BSc/BA/BCom/BCA/BE/BTech/MSc/MCA (CS/IT) I year students