+ 3

Age

#include <iostream> using namespace std; int main() { //your code goes here int age; cin >> age; if (age>=16) { cout << "welcome"; } else { cout << "Not allowed"; } }

8th May 2023, 5:28 PM
MMK
MMK - avatar
18 Respostas
+ 8
Check the spelling of the output. It must be exactly like in the task description
8th May 2023, 6:18 PM
Lisa
Lisa - avatar
+ 4
Check the task's description for the outputs must be the same as described. #include <iostream> using namespace std; int main() { //your code goes here int age; cin >> age; if (age>=16&& age <=60) { cout << "welcome"; } else { cout << "not allowed"; } }
8th May 2023, 6:28 PM
MJNderi coDER
MJNderi coDER - avatar
+ 4
BlunderKing Please read the thread before you paste your answer here.
8th May 2023, 7:41 PM
Lisa
Lisa - avatar
+ 3
What are you trying by this code? when if age >= 16 false then age >= 60 also always false..
8th May 2023, 5:33 PM
Jayakrishna 🇮🇳
+ 2
MMK recheck your reply, it is missing values for the age! If the task is : If age >= 16 then output "Welcome" Else print "not allowed" then your code works fine. But just check output statements spelling from the task description. There "Welcome", capital W but you using small w. "not allowed", all small case but your code has capital N. If there need to check age <= 60 then add this as nested if condition or by compound condition by using &&. Like : if ( age >= 16 && age <= 60 ) Hope it clears....
8th May 2023, 6:21 PM
Jayakrishna 🇮🇳
+ 1
If the user enters 63, then 63 is greater or equal 16. The second else if will not be reached.
8th May 2023, 5:31 PM
Lisa
Lisa - avatar
+ 1
MMK What is the task actually? Add description here..
8th May 2023, 5:56 PM
Jayakrishna 🇮🇳
+ 1
What is the code supposed to do?
8th May 2023, 6:05 PM
Lisa
Lisa - avatar
+ 1
greater or equal than what?
8th May 2023, 6:13 PM
Lisa
Lisa - avatar
+ 1
Lisa thank you so much... It done I written allways "welcome" but it is "Welcome"
8th May 2023, 6:29 PM
MMK
MMK - avatar
+ 1
Great that you could solve it!
8th May 2023, 6:32 PM
Lisa
Lisa - avatar
0
How can i solve this
8th May 2023, 5:36 PM
MMK
MMK - avatar
0
#include <iostream> using namespace std; int main() { int age; cin >> age; if(age >= 16) { cout << "welcome"; } else { cout << "Not allowed"; } }
8th May 2023, 6:04 PM
MMK
MMK - avatar
0
Take the client age as a input, then show output "Welcome" if age is greathear or equal to 16. If it’s not show "not allowed".
8th May 2023, 6:11 PM
MMK
MMK - avatar
0
I tried many way but it’s not working, maybe it is bug from sololearn.
8th May 2023, 6:13 PM
MMK
MMK - avatar
0
Client age should be 16 plus, to output "welcome"
8th May 2023, 6:16 PM
MMK
MMK - avatar
0
Ok
8th May 2023, 6:19 PM
MMK
MMK - avatar
0
Thanks all, for your response....
10th May 2023, 7:26 AM
MMK
MMK - avatar