Home

A program to calculate HRA and DA from Basic Salary

C Programming Language 018

The following code shows how to write a program to explain compound if. To find HRA and DA from Basic Salary.

Program

#include <stdio.h>

void main()
{
    int bs, hra, da;

    printf("Enter basic salary:");
    scanf("%d", &bs);

    if (bs >= 5000)
    {
        hra = 0.10 * bs;
        da = 0.05 * bs;
    }
    printf("hra = %d \n", hra);
    printf("da = %d \n", da);
}

Result

Enter basic salary:5000
hra = 400
da = 250


Last Updated on

Next Post: Rules vs Guidelines →

Comments