Untitled
unknown
plain_text
a year ago
2.0 kB
6
Indexable
Never
using System; namespace TinhGPA { class Program { static void Main(string[] args) { Console.Write("Ho va ten: "); string hoten = Console.ReadLine(); Console.Write("Lop: "); string lop = Console.ReadLine(); Console.Write("Diem_QTH: "); double qth = Convert.ToDouble(Console.ReadLine()); Console.Write("Diem_HTTQL: "); double httql = Convert.ToDouble(Console.ReadLine()); Console.Write("Diem_CSLT: "); double cslt = Convert.ToDouble(Console.ReadLine()); Console.Write("Diem_Triet: "); double triet = Convert.ToDouble(Console.ReadLine()); double gpaQTH = ConvertToGPA(qth); double gpaHTTQL = ConvertToGPA(httql); double gpaCSLT = ConvertToGPA(cslt); double gpaTriet = ConvertToGPA(triet); double gpa = (gpaQTH + gpaHTTQL + gpaCSLT + gpaTriet) / 4; Console.WriteLine($"Sinh vien {hoten.ToUpper()}, Lop {lop}, Dat GPA {gpa},"); if (gpa >= 3.6) { Console.WriteLine("Xep loai Xuat Sac"); } else if (gpa >= 3.2) { Console.WriteLine("Xep loai Gioi"); } else if (gpa >= 2.5) { Console.WriteLine("Xep loai Kha"); } else if (gpa >= 2.0) { Console.WriteLine("Xep loai Trung Binh"); } else { Console.WriteLine("Xep loai Yeu"); } } static double ConvertToGPA(double diemThang10) { if (diemThang10 >= 8.5) return 4.0; else if (diemThang10 >= 7.0) return 3.0; else if (diemThang10 >= 5.5) return 2.0; else return 1.0; } } }