More Related Content
More from อภิญญา คำเหลือ (8)
3 โปรแกรมการคูณเลข 2 ตัว โดยรับข้อมูลจากคีย์บอร์ด
- 1. การเขียนโปรแกรมภาษา C ม.6 วันที่ 9 ตุลาคม 2555
นายอภิญญา คาเหลือ (ผู้สอน)
โปรแกรมการคูณเลข 2 ตัว โดยรับข้อมูลจากคีย์บอร์ด
กาหนดตัวแปร
a, b, c
สูตร
c=a*b
ผลการรันโปรแกรม
## Program Multiply ##
Input A: 2
Input B: 5
Answer: 2 x 5 = 10
Code C.
#include <stdio.h>
main()
{
int a, b, c;
clrscr();
printf("## PROGRAM MULTIPLY ##n");
printf("Input A: ");
scanf("%d", &a);
printf("Input B: ");
scanf("%d", &b);
- 2. c=a*b;
printf("Answer: %d x %d = %d", a, b, c);
getch();
}
ผลรับโปรแกรม