0
int a = 4;
int b = 3;
int c = a/b;
這裏c值爲1.33。現在我需要改變的值作爲整數像2將整數值修改爲最接近整數的舍入
如果
int a =1;
int b = 2;
int c = a/b means the value is 0.5
現在我需要改變的值作爲一個整數像1
int a = 4;
int b = 3;
int c = a/b;
這裏c值爲1.33。現在我需要改變的值作爲整數像2將整數值修改爲最接近整數的舍入
如果
int a =1;
int b = 2;
int c = a/b means the value is 0.5
現在我需要改變的值作爲一個整數像1
請試試這個:
int a = 4;
int b = 3;
int c = Convert.ToInt32(Math.Ceiling(a/b));
@用戶,如果你找到它有幫助,然後將其標記爲答案,以便它也會幫助其他人。 –
...你確定*你的第一個例子是給你'1.33'作爲c的結果嗎? – Rob
@用戶,你想要的天氣四捨五入到下一個整數或最接近的整數。 –
其1.3333333333333333 – User