一、加法運(yùn)算
C語(yǔ)言中實(shí)現(xiàn)加法運(yùn)算的代碼如下
```cclude
tain()
{t; = a + b;tfd);
```d 20 is 30
tf函數(shù)輸出結(jié)果。
二、減法運(yùn)算
C語(yǔ)言中實(shí)現(xiàn)減法運(yùn)算的代碼如下
```cclude
tain()
{t a = 20, b = 10, diff;
diff = a - b;tfced", a, b, diff);
```ced 10 is 10
tf函數(shù)輸出結(jié)果。
三、乘法運(yùn)算
C語(yǔ)言中實(shí)現(xiàn)乘法運(yùn)算的代碼如下
```cclude
tain()
{t a = 10, b = 20, product;
product = a b;tfd", a, b, product);
```d 20 is 200
tf函數(shù)輸出結(jié)果。
四、除法運(yùn)算
C語(yǔ)言中實(shí)現(xiàn)除法運(yùn)算的代碼如下
```cclude
tain()
{tt;t = a / b;tftdt);
```td 10 is 2
ttf函數(shù)輸出結(jié)果。
需要注意的是,如果除數(shù)為0,則程序會(huì)發(fā)生錯(cuò)誤。因此,在實(shí)際應(yīng)用中,我們需要對(duì)除數(shù)是否為0做出判斷。
以上就是C語(yǔ)言四則運(yùn)算的代碼實(shí)現(xiàn),希望對(duì)初學(xué)者有所幫助。