In this program, I am suppose to let the user input data, and the program will calculate what they need and show it. I am suppose to use a while,for, and do loop for this program.

So far I have been successful with the For loop, but I am having a problem with how to use a While and Do loop for this program.

Can someone give me some advice?

Here are my codes :

```
#define _CRT_SECURE_NO_WARNINGS
#include<stdio.h>
#include<stdlib.h>
float load()
{
float sal = 0.0;
printf("Enter Salary\n");
scanf("%f", &sal);
return sal;
}
float calcRate(float s)
{
if (s > 40000)
return 4.0;
if (s >= 30000 && s <= 40000)
return 5.5;
if (s < 30000)
return 7.0;
}
void calcRaise(float sal, float rate, float *raise, float *totraise)
{
*raise = (sal*rate) / (float)100;
*totraise = *totraise + *raise;
}
void calcNewSal(float sal, float raise, float *newsal, float *totnewsal)
{
*newsal = sal + raise;
*totnewsal = *totnewsal + *newsal;
}
void calcTotSal(float *sal, float *totsal)
{
*totsal = *totsal + *sal;
}
void print(float sal, float rate, float raise, float newsal, float totnewsal, float totraise, float totsal)
{
printf(" %0.2f %0.2f %0.2f %0.2f\n", sal,rate,raise,newsal);
}
void main()
{
float sal = 0.0;
float rate, raise, newsal;
float totraise = 0;
float totnewsal = 0;
float totsal = 0;
printf(" Salary Rate %% Raise New Salary\n");
for (int i=1;i<=7;i++)
{
sal = load();
rate = calcRate(sal);
calcRaise(sal, rate, &raise, &totraise);
calcNewSal(sal, raise, &newsal, &totnewsal);
calcTotSal(&sal, &totsal);
print(sal, rate, raise, newsal, totsal, totraise, totnewsal);
fflush(stdin);
}
printf("Total: %0.2f %0.2f %0.2f \n", totsal, totraise, totnewsal);
system("pause");
}
```