0

Why my cost fail in paint cost test

#include <iostream> #include<math.h> using namespace std; int main() { int a; float b = 40.00; float c = 5.00; cin>>a; std::cout<<ceilf((b+c*a)/10+b+c*a); return 0; }

27th Feb 2020, 12:32 PM
Hiếu Võ Trần Minh
Hiếu Võ Trần Minh - avatar
2 Respuestas
+ 4
I had exactly same problem 😏 Then I just replaced ceil with round (you are using ceilf btw) and casted value to int before printing to console. generally it was like : cout << (int) round(that formula); That worked 🙄
27th Feb 2020, 1:15 PM
🇮🇳Omkar🕉
🇮🇳Omkar🕉 - avatar
+ 1
I recommend to use: float a; and 10.0 instead 10
27th Feb 2020, 4:26 PM
JaScript
JaScript - avatar