Halloween candy help C++ | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
0

Halloween candy help C++

Can someone help with the Halloween candy i tried everything but nothing works i ended up all the ideas.

8th Dec 2021, 12:23 PM
Biagio
6 Answers
+ 1
* in the task description it says we're to ROUND UP * output the result
8th Dec 2021, 2:01 PM
Lisa
Lisa - avatar
+ 2
Please link your code attempt, so we can help you with it!
8th Dec 2021, 12:25 PM
Lisa
Lisa - avatar
0
#include <iostream> using namespace std; int main() { int houses; float percentage; cin>>houses; //your code goes here percentage=round((100*2)/houses); return 0; }
8th Dec 2021, 1:09 PM
Biagio
0
Ohhhh
8th Dec 2021, 2:07 PM
Biagio
0
Here is the code try this one double result; result = (2.00 / houses)*100; if (result >200/houses) cout<<(200/houses)+1; else cout << result ;
20th Jul 2022, 10:48 AM
Sanket Athawale
Sanket Athawale - avatar
0
#include <iostream> using namespace std; int main() { int houses; cin>>houses; //your code goes here float toFloat(houses) ; float chance((100/toFloat)*2+.99) ; int out(chance) ; cout << out; return 0; } https://code.sololearn.ucom/cv89oPEObLO4/?ref=app
8th Nov 2022, 10:57 AM
Scott D
Scott D - avatar