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.
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 |
what will be the output of this program........ main() { int a=2,b=4,c=6; printf("%d"); } why it gives the value of third variable.
what is the difference between north western polytechnique university and your applied colleges?? please give ur answers for this. :)
How does normalization of huge pointer works?
Explain Basic concepts of C language?
Is int a keyword in c?
I need testPalindrome and removeSpace #include <stdio.h> #define SIZE 256 /* function prototype */ /* test if the chars in the range of [left, right] of array is a palindrome */ int testPalindrome( char array[], int left, int right ); /* remove the space in the src array and copy it over to the "copy" array */ /* set the number of chars in the "copy" array to the location that cnt points t */ void removeSpace(char src[], char copy[], int *cnt); int main( void ) { char c; /* temporarily holds keyboard input */ char string[ SIZE ]; /* original string */ char copy[ SIZE ]; /* copy of string without spaces */ int count = 0; /* length of string */ int copyCount; /* length of copy */ printf( "Enter a sentence:\n" ); /* get sentence to test from user */ while ( ( c = getchar() ) != '\n' && count < SIZE ) { string[ count++ ] = c; } /* end while */ string[ count ] = '\0'; /* terminate string */ /* make a copy of string without spaces */ removeSpace(string, copy, ©Count); /* print whether or not the sentence is a palindrome */ if ( testPalindrome( copy, 0, copyCount - 1 ) ) { printf( "\"%s\" is a palindrome\n", string ); } /* end if */ else { printf( "\"%s\" is not a palindrome\n", string ); } /* end else */ return 0; /* indicate successful termination */ } /* end main */ void removeSpace(char src[], char copy[], int *cnt) { } int testPalindrome( char array[], int left, int right ) { }
Is there any demerits of using pointer?
write a program to remove duplicate from an ordered char array? in c
While(1) { } when this loop get terminate is it a infinite loop?
Whats wrong with the following function char *string() { char *text[20]; strcpy(text,"Hello world"); return text; }
What is the usage of the pointer in c?
When should the const modifier be used?