Write a C program to find (total allowances and gross salary)

TASK:

Zain’s basic salary is input through the keyboard. His dearness allowance is 25% of basic salary, and house rent allowance is 40% of basic salary. Write a program to calculate and display the total allowances and his gross salary.


OUTPUT:


Here the task asks for a Gross salary which is the sum of allowance and the basic salary below is the code which tells how easily the task can be performed and the above output could be achieved.




CODE:

#include<stdio.h>
int main(){

float allowance,gross_salary,basic_salary;  //initializing variables;

printf("Enter your salary\n");

scanf("%f",&basic_salary);  //Taking value of basic salary from user;

allowance=(basic_salary*0.25)+(basic_salary*0.40);
//calculating allownace by the given data (25%=25/100=0.25) and (40%=40/100=0.40)

gross_salary=allowance+basic_salary;

printf("Gross salary = %0.2f with allowance of %0.2f",gross_salary,allowance);

getchar();
return 0;
}




NEED WORK PRODUCE WORK

My name is Abdul Rehman I am from Pakistan. I am doing BS in Computer and information sciences. Currently, I am creating these blogs to help students of computer sciences all over the world..

6 Comments

Post a Comment
Previous Post Next Post