c++ integer division
// truncates decimal
cout << 20.0 / 3; // 6.66667
cout << 20 / 3; // 6
cout << -20 / 3; // -6
c++ integer division
// truncates decimal
cout << 20.0 / 3; // 6.66667
cout << 20 / 3; // 6
cout << -20 / 3; // -6
floor divide c++
#include<iostream>
int main()
{
//Random float f;
float f = 12.33;
//Getting the floor value of f which is the the whole number part.
//This will return an int.
int result = std::floor(f);
//Printing the answer to the screen.
std::cout << result << std::endl;
//The result should be: 12.
//exiting.
return 0;
}
Copyright © 2021 Codeinu
Forgot your account's password or having trouble logging into your Account? Don't worry, we'll help you to get back your account. Enter your email address and we'll send you a recovery link to reset your password. If you are experiencing problems resetting your password contact us