Write the program with at least two functions to solve the
following problem. The members of the board of a small
university are considering voting for a pay increase for
their 5 faculty members. They are considering a pay
increase of 8%. Write a program that will prompt for and
accept the current salary for each of the faculty members,
then calculate and display their individual pay increases.

At the end of the program, print the total faculty payroll
before and after the pay increase, and the total pay
increase involved.




Write the program with at least two functions to solve the following problem. The members of the bo..

Answer / sammy

#include <stdio.h>
#include <stdlib.h>
double getIncrease (double curSal);

int main (void)
{
double CurrentSal[3];
double payIncreases[3];

for(int i=0; i<3; i++)
{
printf("Enter the salary for employee %d: $", i+1);
scanf("%d", &CurrentSal);
}

for (int j=0; j<3; j++)
{
payIncreases[j] = getIncrease(CurrentSal[j]);
printf("The pay increase for employee %d is $%d\n",j+1,
payIncreases[j]);
}
system ("pause");
return 0;
}
double getIncrease (double curSal)
{
double PayIncrease;
PayIncrease = curSal*.08;

return PayIncrease;
}

Is This Answer Correct ?    1 Yes 1 No

Post New Answer

More C Interview Questions

What is #ifdef ? What is its application?

0 Answers   TCS,


Program to find the value of e raised to power x using while loop

5 Answers   IBM, N Tech,


What does printf does?

0 Answers  


What is meant by keywords in c?

0 Answers  


Why c is called free form language?

0 Answers  


How will you allocate memory to double a pointer?

1 Answers  


What is the most efficient way to store flag values?

0 Answers  


Explain argument and its types.

0 Answers  


What is the process to create increment and decrement stamen in c?

0 Answers  


Differentiate between functions getch() and getche().

0 Answers  


How to reverse alternate words in a given line of string For Eg: my name is narasimha output : my eman is ahmisaran

0 Answers  


what will the following program do? void main() { int i; char a[]="String"; char *p="New Sring"; char *Temp; Temp=a; a=malloc(strlen(p) + 1); strcpy(a,p); //Line no:9// p = malloc(strlen(Temp) + 1); strcpy(p,Temp); printf("(%s, %s)",a,p); free(p); free(a); } //Line no 15// a) Swap contents of p & a and print:(New string, string) b) Generate compilation error in line number 8 c) Generate compilation error in line number 5 d) Generate compilation error in line number 7 e) Generate compilation error in line number 1

1 Answers   IBM,


Categories