how to write a program to illustrate maximum of 3 numbers
Hello there,
You have not mentioned the programming language name. So, below I am illustrating this code in C language.
|
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;
}
Basic logic to find max of three numbers:
if (num1 >= num2) and (num1 >= num3):
largest = num1
elif (num2 >= num1) and (num2 >= num3):
largest = num2
else:
largest = num3
print("The largest number is", largest)