Menu Close

Find the total amount each worker has to pay individually

Isaac has a water leak in his bathroom. So, he had invited two workers for the waterproofing of his bathroom.  But due to the shortage of workers, this work took longer than required.  Because Isaac is a middle-class man, he worries a little about the money he has to pay them. 

So, help him by developing a programming logic to find the total amount each worker has to pay individually.

Input: 
Get the input of each test case that contains a string value representing name, wsal, wdays. 

Output:
Display the output of Worker's Name, total Payment of Workers in a separate line.
#include<stdio.h>
struct worker
{
  char name[100];
  int wage;
  int wdays;
};
int main()
{
  struct worker worker1,worker2;
  scanf("%s %d %d",worker1.name,&worker1.wage,&worker1.wdays);
  scanf("%s %d %d",worker2.name,&worker2.wage,&worker2.wdays);
  int totalw1 = worker1.wage*worker1.wdays;
  int totalw2 = worker2.wage*worker2.wdays;
  printf("%s\n%d\n%s\n%d",worker1.name,totalw1,worker2.name,totalw2);
return 0;
}

INPUT_1:
Nathan
500
6
Simon
600
7

OUTPUT:
Nathan
3000
Simon
4200


INPUT_2:
sam
800
5
Singam
600
6

OUTPUT:
sam
4000
Singam
3600


ILLUSTRATION

Executed using gcc linux terminal

Morae Q!