C 語言新增兩個整數的程式


新增兩個數字的程式需要兩個數字,對其進行數學求和,並將其提供給另一個變數來儲存其總和。

示例程式碼

 即時演示

#include <stdio.h>
int main(void) {
   int a = 545;
   int b = 123;
   printf("The first number is %d and the second number is %d 
", a , b);    int sum = a + b;    printf("The sum of two numbers is %d" , sum);    return 0; }

輸出

The first number is 545 and the second number is 123
The sum of two numbers is 668

更新時間:2019-07-30

971 次瀏覽

開啟您的職業生涯

透過完成課程獲得認證

立即開始
廣告