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
廣告