Create FloorDanCeiling.c

master
MD15 2020-04-10 12:26:06 +07:00 committed by GitHub
parent 5dd7e5dbf9
commit 0a3e89be7f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 24 additions and 0 deletions

View File

@ -0,0 +1,24 @@
#include <stdio.h>
#include <math.h>
int main(void) {
long int c,x;
double a;
scanf("%lf",&a);
if (a == trunc(a)) {
a = trunc(a);
printf("%.0lf %.0lf\n",a,a);
}
else if (a<0) {
c = trunc(a);
x = c-1;
printf("%ld %ld\n",x,c);
}
else if (a>0) {
c = trunc(a);
x = c+1;
printf("%ld %ld\n",c,x);
}
}