Find the max and min from the three numbers.
Flow Char :
Pseudo Code :
1. Start
2. Read the three numbers to be compared, as A, B and C.
3. Check if A is greater than B.
3.1 If true, then check if A is greater than C.
3.1.1 If true, print 'A' as the greatest number.
3.1.2 If false, print 'C' as the greatest number.
3.2 If false, then check if B is greater than C.
3.1.1 If true, print 'B' as the greatest number.
3.1.2 If false, print 'C' as the greatest number.
4. End
#include <stdio.h> int main() { int A, B, C; printf("Enter the numbers A, B and C: "); scanf("%d %d %d", &A, &B, &C); if (A >= B && A >= C) printf("%d is the largest number.", A); if (B >= A && B >= C) printf("%d is the largest number.", B); if (C >= A && C >= B) printf("%d is the largest number.", C); return 0; }
12

Comments
Post a Comment