2. ให้เขียนโปรแกรม สำหรับคำนวณน้ำหนักมาตรฐาน โดยให้ป้อนข้อมูล ส่วนสูง น้ำหนัก เพศ[M , F]
วิธีทำ
include#
void main()
{
     char fm;float h,w;
     clrscr();  
     printf("Your Male(m) or Female(f) : ");    scanf("%c",&fm);
     printf("\nYour Weight : ");     scanf("%f",&w);
     printf("\nYour Hight : ");        scanf("%f",&h);
     switch(fm)
 {
    case 'm': if(h-100==w)   printf("\nYou Standardweight ");
    case 'f':  if(h-110==w)    printf("\nYou Standard weight ");
    else if(h-110)    printf("\nYour weight > Standard : %0.2fkg",w-(h-110));
    else if(h-110>w)    printf("\nYour weight less Than Standard : %0.2fkg",(h-110)-w);break;
    getch();
}
วันพุธที่ 1 ตุลาคม พ.ศ. 2551
สมัครสมาชิก:
ส่งความคิดเห็น (Atom)
 

ไม่มีความคิดเห็น:
แสดงความคิดเห็น