0
Write a program to find out a maximum number from three numbers.
8 Respuestas
+ 2
int main(){
if(num1 > num2 && num1 > num3){
cout << num1;
}
elif(num2 > num1 && num2 > num3){
cout << num2;
}
else{
cout << num3;}
+ 2
If any numbers are the same, it won't work right.
Try
int main(){
if(num1 >= num2 && num1 >= num3){
cout << num1;
}
elif(num2 >= num1 && num2 >= num3){
cout << num2;
}
else{
cout << num3;}
This should work, put in two of the same number and a smaller number
+ 2
cin>>num1>>num2>>num3;
max=num1;
if(max<num2) num2=max;
if(max<num3) num3=max;
cout<<max;
+ 1
Sidenote, I forgot that answer doesn't cover equal numbers, sorry
+ 1
Is this for your homework? :|
0
what do u mean I didn't understand can u explain
0
equal no. means what
0
yes bro it's my home work I am new to the c++
just joined this platform to learn c++
and Aaron it's very true Thanx bro