An interactive c program to read basic salary of 15
persons. each person gets 25% of basic as HRA, 15%of basic
as conveyance allowances, 10%of basic as entertainment
allowances.The total salary is calculated by adding
basic+HRA+CA+EA.Calculate how many out of 15 get salary
above 10,000.Rs also print the salary of each employee

Answer Posted / vignesh1988i

#include<stdio.h>
#include<conio.h>
void main()
{
int salary[50],n,count=0,result[50];
float HRA,CON,JOLLY,TOT_salary;
clrscr();
printf("enter no. of employees : ");
scanf("%d",&n);
for(int i=1;i<=n;i++)
{
printf("%d) ",i);
scanf("%d",&salary[i-1]);
HRA=0.25*salary;
CON=0.15*salary;
JOLLY=0.10*salary;
TOT_salary=HRA+CON+JOLLY;
printf("\nnet salary for %d) is :%f\n",i,TOT_salary);
if(TOT_salary>10000)
{
count++; // TO COUNT EMPLOYEES GETTING MORE THAN 10,000
result[i-1]=i; //TO SAY WHICH SERIAL NO. GETS ABOVE 10,000
}
}
printf("the total no. of employees crossed rs. 10,000 is :%d & respected numbers as above is :",count);
for(i=0;i<count;i++)
printf("%d)\n ",result[i]);
getch();
}

Is This Answer Correct ?    7 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How many types of sorting are there in c?

612


Write a C++ program to generate 10 integer numbers between - 1000 and 1000, then store the summation of the odd positive numbers in variable call it sum_pos, then find the maximum digit in this variable regardless of its digits length.

1570


Do you know pointer in c?

591


Give differences between - new and malloc() , delete and free() ?

612


When was c language developed?

703






main() { inta=10,b=20; a>=5?b=100:b=200; printf("%d ",b); }

912


Explain enumerated types in c language?

606


What is the collection of communication lines and routers called?

614


How to draw the flowchart for structure programs?

8762


Program will then find the largest of three numbers using nested if-else statements. User is prompted to enter three numbers. Program will find the largest number and display it on the screen. All three numbers entered by the user are also displayed. If user enters 21, 33, and 5, the output should be as follows: You entered: 21, 33 and 5. The largest number is 33.

1014


How can I prevent another program from modifying part of a file that I am modifying?

614


How many keywords (reserve words) are in c?

621


What is a pointer on a pointer in c programming language?

621


shorting algorithmS

1803


how to construct a simulator keeping the logical boolean gates in c

1730