Get Email Subscription

Enter your email address:

Delivered by FeedBurner

Wednesday, January 6, 2010

Write a program in C to enter the name , Category and the number of hours worked of an employee and then print his name and wages as per the following

Category
Wages per hour (in Rs.)
1
100
2
80
3
60
4
300




#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
char name [20];
int cat, hrs;
float wages;
printf("Enter the name, category, hours worked \n");
scanf("%s %d %d", name, &cat, &hrs);
switch(cat)
{
case 1:
wages = hrs * 100;
break;

case 2:
wages = hrs * 80;
break;

case 3:
wages = hrs * 60;
break;

case 4:
wages = hrs * 30;
break;

default :
wages = 0.0;
}
Printf("Name is %s and wages = Rs. %f \n, name, wages");
}

For eg :-

Output :-
Enter the name, category, hours worked
Fransis 4 7
Name is Fransis and wages = Rs. 210.000000

Related Posts by Categories



0 comments:

About This Blog

Lorem Ipsum

  © Blogger templates Newspaper III by Ourblogtemplates.com 2008

Back to TOP