C 'de Matematik Fonksiyonları -Ceil Floor Kullanımı

The floor and ceiling functions give us the nearest integer up or down.
  • FLOOR :int(−3.65) = −4 (the same as the Floor function)
  • CEIL:  int(−3.65) = −3 (the neighbouring integer closest to zero, or "just throw away the .65")
  • FLOOR:  int(3.65)=3
  • CEIL :int(3.65)=4 or
  • FLOOR:int(2.31)=2 // int(-2.32) -->-3
  • CEIL:int(2.31)=3 // int(-2.31) -->-2
#include <stdio.h>

int main(void)
{
double sayi,sonuc1,sonuc2;
printf("degeri giriniz:");
scanf("%lf",&sayi);

sonuc1=floor(sayi);
printf(" floor sonuc : %.f\n",sonuc1);

sonuc2=ceil(sayi);
printf(" ceil sonuc : %.f",sonuc2);




getch();
}

Yorumlar

Yorum Gönder