當前位置:首頁 » 編程語言 » C語言上升法

C語言上升法

發布時間: 2024-09-18 02:42:31

❶ 關於C語言的除法與取整問題!

函數名: ceil
功 能: 向上舍入
用 法: double ceil(double x);
函數名: floor
功 能: 向下舍入
用 法: double floor(double x);

另外 (int)(表達式) ,將 [表達式]結果向下取整

下面舉一例:
#include<stdio.h>
#include<math.h>
int main(void){
int x=11;
int y=0,z=0;
double a=12.69,b=0.0,c=0.0;
y = x/3 ;
z = (int)a;
b = floor(a);
c = ceil(a);
printf("\n \t y = %d \n",y); // y = 3
printf("\n \t z = %d \n",z); // z = 12
printf("\n \t b = %5.2lf",b); // b = 13.00
printf("\n \t c = %5.2lf",c); // c = 12.00
return 0;
}

熱點內容
php辦公系統 發布:2025-07-19 03:06:35 瀏覽:896
奧德賽買什麼配置出去改裝 發布:2025-07-19 02:53:18 瀏覽:38
請與網路管理員聯系請求訪問許可權 發布:2025-07-19 02:37:34 瀏覽:187
ipad上b站緩存視頻怎麼下載 發布:2025-07-19 02:32:17 瀏覽:842
phpcgi與phpfpm 發布:2025-07-19 02:05:19 瀏覽:525
捷達方向機安全登錄密碼是多少 發布:2025-07-19 00:57:37 瀏覽:690
夜魔迅雷下載ftp 發布:2025-07-19 00:39:29 瀏覽:97
增值稅票安全接入伺服器地址 發布:2025-07-19 00:20:45 瀏覽:484
solidworkspcb伺服器地址 發布:2025-07-18 22:50:35 瀏覽:820
怎麼在堆疊交換機里配置vlan 發布:2025-07-18 22:42:35 瀏覽:628