fork download
  1. #include<stdio.h>
  2. int main(){
  3. float x;
  4. scanf("%f",&x);
  5. int floor=(int)x;
  6. if(x<0 && x!=floor){
  7. floor--;
  8. }
  9.  
  10. int ceil=floor;
  11. if(x>floor){
  12. }
  13. int round_off=floor;
  14. if((x-floor)>=0.5){
  15. round_off++;
  16. }
  17. printf("%d %d %d",floor,ceil,round_off);
  18. }
  19.  
  20.  
  21.  
Success #stdin #stdout 0.01s 5284KB
stdin
-2.7
stdout
-3 -2 -3