Write a program to find out the maximum of any 3 input given by user. Example: If input given by user is A=5. B=7 and C=2 then Output is B is the Maximum.
Answers
Answer:
Write a program to find out the maximum of any 3 input given by user. Example: If input given by user is A=5. B=7 and C=2 then Output is B is the Maximum.
Answer:
The answer to the given question is explained in the explanation.
Explanation:
To find the largest of three numbers, the algorithm is:
Asks the user to enter three integers.
: Read three integer values into num1, num2, and num3 (integer variable).
Check if num1> num2
: If true, check if num1 is greater than num3.
: If true, print "num1" as the largest number.
: If false, print "num3" as the largest number.
: If false, check if num2 is greater than num3.
: If true, print "num2" as the largest number.
: If false, print "num3" as the largest number.
include stdio.h>
num1, num2, num3, largest;
printf("Please Enter three different values");
scanf("percent d percent d percent d", &num1, &num2, &num3);
largest =((num1>num2 && num1>num3)?
Number 1: (num2>num3)?(num2:num3);
printf("Largest number = percent d n,"largest);
return 0;
#SPJ6