Why this answer isn't ok? Training coding | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
- 1

Why this answer isn't ok? Training coding

Can someone tell me what's wrong? #include <iostream> #include <cmath> using namespace std; int main() { int houses; cin>>houses; //your code goes here double var; var = (2.0 / houses) * 100; double percent; percent = round(var); cout << percent; return 0; }

21st Jun 2021, 10:57 PM
Hybr1d Theory
Hybr1d Theory - avatar
2 Answers
22nd Jun 2021, 12:53 AM
Simba
Simba - avatar
0
Test just is: "You go trick or treating with a friend and all but three of the houses that you visit are giving out candy. One house that you visit is giving out toothbrushes and two houses are giving out dollar bills. Task Given the input of the total number of houses that you visited, what is the percentage chance that one random item pulled from your bag is a dollar bill? Input Format An integer (>=3) representing the total number of houses that you visited. Output Format A percentage value rounded up to the nearest whole number."
21st Jun 2021, 11:02 PM
Hybr1d Theory
Hybr1d Theory - avatar