Write a program that finds the greatest number with in give 3 number by the user | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Write a program that finds the greatest number with in give 3 number by the user

I Wana easy code

4th Dec 2016, 9:39 PM
amr
amr - avatar
3 Answers
+ 3
You need to make 3 comparation... soomething like that if (a>b&&a>c) print (a) if (b>c && b>a) print (b) if (c>a && c>b) print (c) Still, you need to check what happens if all numbers are equals.
4th Dec 2016, 9:45 PM
Nahuel
Nahuel - avatar
+ 2
if you're coding in java an easy solution is this: double largestNumber = Math.max(num1,Math.max(num2,num3)); if you're coding in c# an easy solution is this: double largestNumber = Math.Max(num1,Math.Max(num2,num3));
4th Dec 2016, 9:56 PM
Ousmane Diaw
0
Thx bro
4th Dec 2016, 9:47 PM
amr
amr - avatar