Answers for "floor divide c++"

C++
0

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;
}
Posted by: Guest on August-03-2021

Browse Popular Code Answers by Language