C program to find the greatest of three numbers
belongs to collection: C programs - Basic C Programs
All Answers
total answers (1)
Severity: 8192
Message: str_replace(): Passing null to parameter #3 ($subject) of type array|string is deprecated
Filename: libraries/Filtered_db.php
Line Number: 23
belongs to collection: C programs - Basic C Programs
total answers (1)
C program to find the greatest of three numbers - Source code
Program Output
Program Explanation
1. Take the three numbers and store it in the variables n1, n2 and n3 respectively.
2. Firstly check if the n1 is greater than n2. If it is, then check if it is also greater than n3? If this is also true than print the result as "Number1 is the greatest among three". Otherwise, it is obvious that n3 is largest among three so print the output as “Number3 is the greatest among three”.
3. If the n1 is not greater than n2, then check the relation between n2 and n3.
4. If n2 is greater than n3, then print the output as “Number2 is the greatest among three”.
need an explanation for this answer? contact us directly to get an explanation for this answer