Answer:
#include<stdio.h>
#include<string.h>
int main() {
int n;
FILE *fp = fopen("salaries.txt", "r");
double sumSalaries = 0;
double quarterlySalary1, quarterlySalary2, quarterlySalary3, quarterlySalary4;
while(!feof(fp)) {
fscanf(fp, "%lf", &quarterlySalary1);
fscanf(fp, "%lf", &quarterlySalary2);
fscanf(fp, "%lf", &quarterlySalary3);
fscanf(fp, "%lf", &quarterlySalary4);
sumSalaries = sumSalaries + quarterlySalary1+quarterlySalary2+quarterlySalary3+quarterlySalary4;
printf("Salary Sum %lf: \n", sumSalaries);
printf("Income Type: ");
if(sumSalaries > 200000 ){
printf("h");
}
else if(sumSalaries >= 15000 && sumSalaries<=200000){
printf("m");
}
else{
printf("l");
}
printf("\n");
}
fclose(fp);
return 0;
}
Explanation: