From 3eba783118c94037f51a22e8530175c97d8de40f Mon Sep 17 00:00:00 2001 From: saurabhasnare <66157342+saurabhasnare@users.noreply.github.com> Date: Fri, 2 Oct 2020 17:46:35 +0530 Subject: [PATCH] largest up --- C/largest.c | 27 ++++++--------------------- 1 file changed, 6 insertions(+), 21 deletions(-) diff --git a/C/largest.c b/C/largest.c index f3b0cc8..a27aa07 100644 --- a/C/largest.c +++ b/C/largest.c @@ -5,31 +5,16 @@ File Name: largest.c Date : 17/10/2012 */ + #include main() { - int a,b,c; - printf("\nEnter 3 no.s"); + int a,b,c,big; + printf("\nEnter 3 numbers:"); scanf("%d%d%d",&a,&b,&c); - if(a>b) - { - if(a>c) - { - printf("%d is largest",a); - } - else - { - printf("%d is largest",c); - } - } - else if(b>c) - { - printf("%d is largest",b); - } - else - { - printf("%d is largest",c); - } + big = a > b ? ( a > c ? a : c) : (b > c ? b : c) ; + printf("\nThe biggest number is : %d", big); + }