mercredi 10 février 2021

what is ceil of 1/2 and 0.5 [duplicate]

Why is it that ceil(2/5) is 0 and ceil(0.5) or ceil(0.1) is 1

#include <iostream>
#include <math.h>
int main() {
    // Write C++ code here
    std::cout << "Hello world!";
    std::cout<<ceil(2/5);
    return 0;
}

i want to use ceil(1/2) in my another code but it keeps returning 0 how to correct it ?

Aucun commentaire:

Enregistrer un commentaire