Programming In C Practical 10

Question 1
A bank introduced an intensive policy of giving bonus to all account holders. The policy is as follows: A bonus of 2% of the balance is given to everyone irrespective of their balance and 5% to women if their balance is more than 5000. Enter the balance, gender, and calculate the bonus.
Account.cpp
C
				#include<stdio.h>
#include<conio.h>

void main()
{
	clrscr();
	char gender;
	float balance,bonus;
	printf("\nEnter gender of account holder: ");
	scanf(" %c",&gender);
	printf("\nEnter balance in account: ");
	scanf("%f",&balance);
	if(gender=='f'&&balance>5000)
	{
		bonus=(5*balance)/100;
	}
	else
	{
		bonus=(2*balance)/100;
	}
	printf("\nYour bonus is: %f",bonus);
	
	getch();
}
			
Output
Question 2
An Electric power distribution company charges are as follows.
1. for 0-200 units -- rs. 0.5/unit
2. for 201-400 units-- rs 100+0.65/unit excess of 200units
3. for 401-600 units-- rs 230+0.80/unit excess of 400units
4. for 601 and above units-- rs 390+1.00/unit excess of 600units
Input customer number and power units consumed. Print amount to be paid.
Bill.cpp
C
				#include<stdio.h>
#include<conio.h>

void main()
{
	clrscr();
	int cno,units;
	float bill;
	printf("\nEnter customer number: ");
	scanf("%d",&cno);
	printf("\nEnter power units consumed: ");
	scanf("%d",&units);
	if(units>=0&&units<=200)
	{
		bill=0.5f*units;
	}
	else if(units>=201&&units<=400)
	{
		bill=100+0.65f*(units-200);
	}
	else if(units>=401&&units<=600)
	{
		bill=230+0.8f*(units-400);
	}
	else if(units>=601)
	{
		bill=390+(units-600);
	}
	
	printf("\nYour bill amount to be paid is: %f rupees",bill);
	
	getch();
}
			
Output

Leave a Comment

Your email address will not be published. Required fields are marked *