C Program to Find Largest of Three numbers
In this post explain C program to find largest of three numbers. Ready to execute code with clean output, in easy way with simple program with steps.
Here to ask user to enter the input of three number, now start checking which one is the largest number. After finding the largest, display that number as the largest number of the three number.
Also see : C Program for Reading Integer Numbers
C Program to Find Largest of Three Numbers
Following C program ask to the user to enter the three number to check which one is the largest or biggest of the three number, then display the result on the screen:
/* C Program - Find Largest of Three Numbers */ #include<stdio.h> main() { float A, B, C; printf("Enter three values\n"); scanf("%f %f %f", &A, &B, &C); printf("\nLargest value is "); if (A>B) { if (A>C) printf("%f\n", A); else printf("%f\n", C); } else { if (C>B) printf("%f\n", C); else printf("%f\n", B); } }
Output
Enter three values 22456 57587 99943 Largest value is 99943.000000
Let me know if you find any difficulty in understanding this C program with simple code and I would be glad to explain it further.