program to find out the largest no among three number using conditional and ternary operator

 

How do you find the largest of 3 numbers in C? ,What is conditional operator in C with example?The program output is also shown below. * C program to find the biggest of three numbers. int num1, num2, num3; printf("Enter the values of num1, num2 and num3\n"); scanf("%d %d %d", &num1, &num2, &num3); printf("num1 = %d\tnum2 = %d\tnum3 = %d\n", num1, num2, num3); if (num1 > num2) if (num1 > num3) More items...  C Program to Find the Biggest of 3 Numbers - Sanfoundrywww.sanfoundry.com › c-program-biggest-3-numbers,

 program to find out the largest no among three number using conditional and ternary operator */

#include<stdio.h>

#include<conio.h>

main()

{        int a,b,c;

         clrscr();

         printf(" \ n Enter the values for a, b and c =");

         scanf("%d%d%d",&a,&b,&c);

         (a>b)? (a<c)?printf("%d is largest",a): printf("%d is largest ",c):(b>c)?printf("%d is           largest",b):printf("%d is largest",c);

        getch();

}

/* Output :--

                    Enter the values for a, b and c =34

                                                                       89

                                                                       78

                    50 is largest

*/

                                        

https://forgetcode.com/c/1414-biggest-of-three-numbers-using-conditional-operator-ternary-operator

                                            💬💭👇👍😊

No comments:

Post a Comment

This Blog helps you to learn basics to high level programming coding and practicals.
conceptual understanding

c program, Advance coding, c++ program, simple program, Advance language

online quiz Application project page MCA final year project

  Here we making a quiz application ppt presentation for college project so that our project idea will like to our professor and teacher  fi...