using System.Collections.Generic;
using System.Threading.Tasks;
using System.Windows.Forms;
void calculate(object sender, EventArgs ea);
class Student : Form, GPA
int sub; double gpa,cgpa; int ch = 3;
Button btnzahi = new Button();
btnzahi.Text = "Calculate";
btnzahi.Location = new Point(
(ClientSize.Width - btnzahi.Width) / 2,
(ClientSize.Height - btnzahi.Height) /2);
btnzahi.Click += new EventHandler(calculate);
Console.WriteLine("Enter the Number of Subject");
sub = Convert.ToInt32(Console.ReadLine());
for (int i = 1; i <= sub; i++)
Console.WriteLine("Enter the GPA of the Subject:" + i);
gpa = Convert.ToDouble(Console.ReadLine());
Console.WriteLine("Total Credit Hours:" + sub * ch);
public void calculate(object sender, EventArgs ea)
MessageBox.Show("CGPA:" + (cgpa/sub).ToString("0.0"), "CGPA", MessageBoxButtons.OK,MessageBoxIcon.Information);
static void Main(string[] args)
Console.WriteLine("Enter Your VUID");
string vuid = Console.ReadLine();
Application.Run(new Student());