Ha Cong Hau
unread,Nov 13, 2012, 7:51:18 AM11/13/12Sign in to reply to author
Sign in to forward
You do not have permission to delete messages in this group
Either email addresses are anonymous for this group or you need the view member email addresses permission to view the original message
to ky_thuat_...@googlegroups.com
Đây là bài 20 trông bài tập nó sẽ giúp các bạn hiểu hơn về lệnh if và cách lồng lệnh if và chương trình nhỏ
#include "stdafx.h"
#include "conio.h"
#include "stdio.h"
#include "string.h"
int _tmain(int argc, _TCHAR* argv[])
{
float t,l,h,tb,diem;
char hs[50];
printf("Nhap ten hoc sinh :" );gets_s(hs);
printf("\nNhap diem ba mon toan li hoa:");
scanf_s("%f%f%f",&t,&l,&h);
tb=(t+l+h)/3;
printf("\nHoc sinh :%s",hs);
printf("\nDiem trung binh mon : %.2f",tb);
if (0<tb&&tb<4) printf("\nBan la hoc sinh loai F");
else {
if (3.9<tb&&tb<5.5) printf("\nBan la hoc sinh loai D");
else
{
if (5.4<tb&&tb<7) printf("\nBan la hoc sinh loai C");
else
{
if (6.9<tb&&tb<8.5) printf("\nBan la hoc sinh loai B");
else printf("\nBan la hoc sinh loai A");
}}}
_getch();
return 0;
}
Có gì thắc mắc thì cứ pm vào mail của mình nha