Computer >> บทช่วยสอนคอมพิวเตอร์ >  >> การเขียนโปรแกรม >> การเขียนโปรแกรม C

โปรแกรม C บวกจำนวนเต็ม 2 จำนวน


โปรแกรมบวก 2 จำนวน รับตัวเลข 2 ตัว ทำการบวกทางคณิตศาสตร์ เก็บผลรวมในตัวแปรอื่น

โค้ดตัวอย่าง

#include <stdio.h> int main(void) { int a = 545; int b = 123; printf("The first number is %d and the second number is %d \n", 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