Could someone help me please? I can’t get it to work, and it wouldn’t show me salary in two significant digits for example

Enter # of hours worked (-1 to end): 41
Enter hourly rate of the worker ($00.00): 10.00
Salary is $415.00

Enter # of hours worked (-1 to end): 40
Enter hourly rate of the worker ($00.00): 10.00
Salary is $400.00

This is what I have So far:

/* This program will determine the gross pay for each employee. */

#include <stdio.h>

int main(void)
{
			/* Declare variables */
      
      int salary;    		/* salary pay */
      int hours;    		/* hours worked */
      int rate;     		/* hourly wage */

      int counter = 0;

/* Prompt for input values from the screen */

               /*... use printf and scanf here*/
printf("Enter # of hours worked (-1 to end): ");
scanf("%f", &hours);
printf("Enter the rate of the worker ($00.00): ");
scanf("%f", &rate);

if ( hours <=40)
   {

      /* calculate gross pay */
      salary = rate * hours;
   
     /*... now print out to the screen using printf (ie, print the value) */

printf("Salary is $%f\n", salary );
}/*end if*/
if ( hours <=80)
   {
printf("Who are you kidding? Go see the boss!\n" );

}/*end if*/
else
{
	/*salary = rate * hours+(hours-40)*(overt);*/
	salary = 40 * rate + (hours - 40) * (rate * 1.5);

printf( "Salary is $%f\n", salary ); 
}

return 0;
} /* end of main */

Thanks in advance for any help.

salary and rate needs to be floats not ints
To display only two digits in the decimal section:

printf( "%.2f\n", salary );
Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.