Itssuman1808

Program uses nested if...else statement to find the largest

Sep 3rd, 2018
64
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.48 KB | None | 0 0
  1. // Program uses nested if...else statement to find the largest number among three
  2. #include <stdio.h>
  3. void main()
  4. {
  5.     double n1, n2, n3;
  6.  
  7.     printf("Enter three numbers: ");
  8.     scanf("%lf %lf %lf", &n1, &n2, &n3);                //coded by Suman Maji,EIEM,Salboni
  9.     if( n1>=n2 && n1>=n3)
  10.         printf("%.2lf is the largest number.", n1);
  11.     else if (n2>=n1 && n2>=n3)
  12.         printf("%.2lf is the largest number.", n2);
  13.     else
  14.         printf("%.2lf is the largest number.", n3);
  15.  
  16. }
Add Comment
Please, Sign In to add comment