+ 1
IF ELSE STATEMAENT USE
How can i make a program where ... like this Enter your age // if > 17 You r adult // else You r child // if >= 50 then You r old ... But when i make this... Its output is like that You r adult you r old How to remove first line that u r adult if age is 50 or more
10 ответов
+ 5
Just restructure it a little:
if (age >= 50)
cout << "You are old";
else if (age > 17)
cout << "You are an adult";
else
cout << "You are a child";
+ 4
If(age >= 50)
cout<<"you are old"<<endl;
else If(age > 17)
cout<<"you are a adult"<<endl;
else
cout<<"you are a child";
+ 2
Thanks buddy
+ 2
You are always welcome
+ 2
I was saying it to AGBENIGA EMMANUEL
+ 2
ok thanks, i used Javascript, am still a beginner, hopefully i will be as good as you guys one day, cheers
+ 1
Actually I think you should use c++ or c here
0
var age= prompt("input your age")
if (age>17) {
alert("You are an adult");
}
else {
alert("You are a Child");
}
if (age >=50) {document.write ("You are Old")
}
0
I'm using c++