วันอาทิตย์ที่ 3 พฤศจิกายน พ.ศ. 2556

Posted by Unknown |
โปรแกรมคำนวณหาพื้นที่ของสามเหลี่ยม Area = ½ x ฐาน x สูง โดยมีข้อมูลเข้า (Input) จากคีย์บอร์ด คือ ค่าของฐานของสามเหลี่ยม (b: Base) และค่าความสูงของสามเหลี่ยม (h: Height) พร้อมพิมพ์ผลลัพธ์
  1. /*c-dos.blogspot.com*/
  2. #include <stdio.h>
  3. #include <conio.h>
  4. main ()
  5. {
  6.     int b,h,area;
  7.     printf("Enter Base:");
  8.     scanf("%d",&b);
  9.     printf("Enter Height:");
  10.     scanf("%d",&h);
  11.     area=(0.5*b*h);
  12.     printf("Area is = %d",area);
  13. getch();
  14. return 0;
  15. }

1 ความคิดเห็น: