C# Program to calculate gross salary of an employee.

/* C# Program to calculate gross salary of an employee */
using System;
public class Demo
{
    public static void Main(string[] args)
    {
        Double Basic_Salary, DA, HRA, Gross_Salary;

        Console.Write("Enter Basic Salary : ");
        Basic_Salary = Convert.ToInt32(Console.ReadLine());

        DA = (Basic_Salary * 40) / 100;
        HRA = (Basic_Salary * 20) / 100;
        Gross_Salary = Basic_Salary + DA + HRA;

        Console.Write("\n\nDearness Allowance 40 % of Basic Salary : " + DA);
        Console.Write("\nHouse Rent 20 % of Basic Salary : " + HRA);
        Console.Write("\nGross Salary : " + Gross_Salary);
        Console.ReadLine();
    }
}

Output :
Enter Basic Salary : 20000

Dearness Allowance 40 % of Basic Salary : 8000
House Rent 20 % of Basic Salary : 4000
Gross Salary : 32000



Leave a comment