- 3
Y have error for test 3, 4 and i don't know for why?
Admission to the pool is free for children under 7 years of age. The given program takes age as an input. Task Complete the code to output "free" if the child's age is less than 7. Sample Input 6 Sample Output free
7 ответов
+ 1
You are comparing the input age to itself age. This will produce "free" for any input.
if (age<=6){cout<<"free"<<endl;}
else if (age>6){cout<< ""<<endl;}
Now comparing to 6.
0
My code : #include <iostream>
using namespace std;
int main() {
int age;
cin >> age;
// your code goes here
if (age<=age){cout<<"free"<<endl;
}
else if (age>age){cout<< ""<<endl;}
return 0;
}
0
Thank's
0
#include <iostream>
int main() {
int age;
std::cin >> age;
// your code goes here
if (age <= 7){
std::cout << "free";
}
else if (age > 7){
std::cout << "";
}
return 0;
}
// FZ
0
#include <iostream>
using namespace std;
int main() {
int age;
cin >> age;
// your code goes here
if (age<=7){cout<<"free"<<endl;
}
else if (age>7){cout<< ""<<endl;}
return 0;
}
Good Luck
0
#include <iostream>
int main() {
int age;
std::cin >> age;
// your code goes here
if (age <= 7){
std::cout << "free";
}
else if (age > 7){
std::cout << "";
}
return 0;
}
//AHS
- 1
int age;
cin >> age;
// your code goes here
if (age <= 7){
cout<<"free";
}else if (age > 7){
cout<<"";
}
this one works