+ 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

7th Dec 2018, 2:49 AM
waqar younis
waqar younis - avatar
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";
7th Dec 2018, 3:06 AM
Kishalaya Saha
Kishalaya Saha - avatar
+ 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";
7th Dec 2018, 3:24 AM
Soham More
Soham More - avatar
9th Jun 2021, 8:42 AM
Tharul Nejana
Tharul Nejana - avatar
+ 2
Thanks buddy
7th Dec 2018, 6:10 AM
waqar younis
waqar younis - avatar
+ 2
You are always welcome
7th Dec 2018, 10:40 AM
Soham More
Soham More - avatar
+ 2
I was saying it to AGBENIGA EMMANUEL
9th Dec 2018, 11:18 AM
Soham More
Soham More - avatar
+ 2
ok thanks, i used Javascript, am still a beginner, hopefully i will be as good as you guys one day, cheers
9th Dec 2018, 12:34 PM
AGBENIGA AGBOOLA EMMANUEL
AGBENIGA AGBOOLA EMMANUEL - avatar
+ 1
Actually I think you should use c++ or c here
9th Dec 2018, 10:15 AM
Soham More
Soham More - avatar
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") }
9th Dec 2018, 1:26 AM
AGBENIGA AGBOOLA EMMANUEL
AGBENIGA AGBOOLA EMMANUEL - avatar
0
I'm using c++
9th Dec 2018, 10:29 AM
waqar younis
waqar younis - avatar