All articles
c

A program to calculate HRA and DA from Basic Salary

Share this article

Share on LinkedIn Share on X (formerly Twitter)

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

Comments