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
What is atoi and atof in c?
difference between Low, Middle, High Level languages in c ?
Differentiate between calloc and malloc.
Why do some versions of toupper act strangely if given an upper-case letter?
Explain the binary height balanced tree?
Explain what are multidimensional arrays?
why use functions a) writing functions avoids rewriting the same code over and over b) using functions it becomes easier to write programs and keep track of what they are doing c) a & b d) none of the above
Why is c not oop?
What is the acronym for ansi?
hw can we delete an internal node of binary search tree the internal node has child node..plz write progarm
What is the use of structure padding in c?
Is c language still used?
Can you apply link and association interchangeably?
An integer that indentifies the position of a data item in a sequence of data items a) value b) number c) index d) all of the above
How can I open a file so that other programs can update it at the same time?