Advertisement
fueanta

#Floor #Ceiling

Nov 25th, 2016
214
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 0.41 KB | None | 0 0
  1. // cpp program to find the floor and ceiling of a given floating point value
  2.  
  3. #include <iostream>
  4. using namespace std;
  5.  
  6. int main() {
  7.     cout << "Given floating point value: ";
  8.     float value; cin >> value;
  9.     cout << "\nFloor: " << int(value) << endl;
  10.     if (value == int(value))
  11.         cout << "\nCeiling: " << int(value) << endl << endl;
  12.     else cout << "\nCeiling: " << int(value) + 1 << endl << endl;
  13.     return 0;
  14. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement