Print -
How to use C# if else statements
using System;
using System.Windows.Forms;
namespace WindowsApplication1
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void button1_Click(object sender, EventArgs e)
{
int totalMarks = 59;
if (totalMarks >= 80) {
MessageBox.Show("Got Higher First Class ");
}
else if (totalMarks >= 60) {
MessageBox.Show("Got First Class ");
}
else if (totalMarks >= 40){
MessageBox.Show("Just pass only");
}
else {
MessageBox.Show("Failed");
}
}
}
}