ceil?

1
2
3
4
5
6
7
8
9
10
11
12
13
#include <cmath>
#include <iostream>
using namespace std;
int main()
{
    float v, n;
    float k;
    cin >> v;
    cin >> n;
    k = (v * 12)/ n;
    cout << ceil((int)k);
    return 0;
}


For some reason ceil doesn't work... Could someone help?
You're truncating the number before even giving it to ceil.

Remove the cast to int and it should work.
Last edited on
closed account (2NywAqkS)
Why have you made k an integer on line 11? take out (int) and see if you get the same problem
It worked :) Thanks
Topic archived. No new replies allowed.