[ create a new paste ] login | about

Link: http://codepad.org/MIoAWWp8    [ raw code | output | fork ]

C, pasted on Mar 3:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
#include <stdio.h>

main() {
    float x;
    scanf("%f",&x);
    x=3.5;

    if ((x - ((int)x)) >=0.5){
        x = ((int) x );
        x++;
        printf("%.0f", x);
    }
    else{
        x = ((int) x );
        printf("%.0f", x);
    }   
}


Output:
1
4


Create a new paste based on this one


Comments: