Chào mọi người! Em là thành viên mới (lập trình lẫn trang daynhauhoc.com ). Hiện tại em chỉ vừa mới bắt đầu với C và đang giải bài thì không hiểu nó sai chổ nào. Mong mọi người giúp đỡ ( tại vì em tự học chứ không có trường lớp).
Đề bài là: hỏi xem người dùng học khối nào? Nhập điểm vào và tính điểm trung bình.
#include <iostream>
#include <stdio.h>
#include <conio.h>
#include <scsiscan.h>
char group;
float math, physics, chemistry, literature, history, geography, average;
int main(void) {
printf("Whats your group ? (A/B)\n");
scanf(" %c", &group);
if (group == 'A'){
printf("Enter your Math's mark : \n");
scanf(" %f", &math);
printf("Enter your Physics' mark : \n");
scanf(" %f", &physics);
printf("Enter your Chemistry's mark : \n");
scanf(" %f", &chemistry);
average = (math + physics + chemistry) / 3;
printf("Your average is : %.1f ", average);
} else {
printf("Enter your Literature's mark :");
scanf(" %f", &literature);
printf("Enter your History' mark :");
scanf(" %f", &history);
printf("Enter your Geography's mark :");
scanf(" %f", &geography);
average = (literature + history + geography) / 3;
printf("Your average is : %.1f ", average);
}
getch();
return 0;
}
do em newbie nên ko đang hình được

anh không nghĩ do
83% thành viên diễn đàn không hỏi bài tập, còn bạn thì sao?