Math, asked by piara1855, 1 year ago

Write a program to calculate overtime pay of 10 employees. Overtime is paid at the rate of rs. 12.00 per hour for every hour worked above 40 hours. Assume that employees do not work for fractional part of an hour.

Answers

Answered by rishika79
20

Answer:

Step-by-step explanation:

#include<stdio.h>

#include<conio.h>

void main()

{

clrscr();

int i, time_worked, over_time, overtime_pay=0;

for(i=1;i<=10;i++)

{

printf("\nenter the time employee worked in hr ");

scanf("%d",&time_worked);

if(time_worked>40)

{

over_time=time_worked-40;

overtime_pay=overtime_pay+(12*over_time);

}

}

printf("\nTotal Overtime Pay Of 10 Employees Is %d",overtime_pay);

getch();

Hope it helps you.....

Answered by 45mehul
2

first sort the array in nlgn and then its easy just take two pointers one pointing ats start index of array and one at the end of the array and start checking sum

like this

whwrw a is the integer array givcen

int *p;

int *q;

p=a;

q=a+n-1;

while(p!=q)

{

if(*p+*q==sum)

{printf("(%d,%d)\n",*p,*q);

p++;

q--;

continue;}

if(*p+*q<sum)

{

p++;

continue;

}

q--;

}

Similar questions