ceil?

Elzi666 (5)
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?
Branflakes91093 (144)
You're truncating the number before even giving it to ceil.

Remove the cast to int and it should work.
Last edited on
Rowan836 (122)
Why have you made k an integer on line 11? take out (int) and see if you get the same problem
Elzi666 (5)
It worked :) Thanks
Registered users can post here. Sign in or register to post.