PROGRAM - 2(a)
Mr. Gupta deposited Rs.1000 in a bank. The bank gives simple interest at the rate of 15% per annum. Write a program to determine the amount in Mr. Gupta’s account at the end of 5 years(Use the Formula I=PTR/100).
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
long p,t,r,i,amount;
//p=1000,t=5,r=15;
clrscr();
printf("\n Enter the values of P,T,R:");
scanf("%ld %ld %ld",&p,&t,&r);
i=(p*t*r)/100;
amount=p+i;
printf("Amount= %ld",amount);
getch();
}
/*
INPUT:enter the values for p,t,r1000
60
15
OUTPUT:the total amount after given years is 10000.000000
*/
PROGRAM - 2(b)
A Cashier has currency notes of denominations Rs. 10, Rs. 50 and Rs.100. If the amount to be withdrawn is input in hundreds, find the total number of notes of each denomination the cashier will have to give to the withdrawer.
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
int amount,hundreds,fifties,tens,change;
clrscr();
printf("enter the value for amount");
scanf("%d",&amount);
hundreds=amount/100;
amount=amount%100;
fifties=amount/50;
amount=amount%50;
tens=amount/10;
change=amount%10;
printf("the total number of hundreds=%d,fifties=%d,tens=%d change=%d",hundreds,fifties,tens,change);
getch();
}
/*
INPUT: enter the value for amount 984
OUTPUT: the total number of hundreds=9,fifties=1,tens=3,change=4
*/
PROGRAM - 2(c)
In town, the percentage of men is 52. The percentage of total literacy is 48. If the total percentage of literate men is 35 of the total population, write a program to fine the total number of illiterate men and women if the population of the town is 8000.
Program:
#include<stdio.h>
#include<conio.h>
void main()
{
long tp,tm,tl,tw,lm,lw,im,iw,ti;
clrscr();
tp=8000;
tm=(tp*52)/100;
printf("Total men = %d",tm);
tl=(tp*48)/100;
printf("\n Total literates = %d",tl);
tw=tp-tm;
printf("\n Total women = %d",tw);
lm=(tp*35)/100;
printf("\n Total literate men = %d",lm);
lw=tl-lm;
printf("\n Total literate women = %d",lw);
im=tm-lm;
printf("\n Total illiterate men = %d",im);
iw=tw-lw;
printf("\n Total illiterate women = %d",iw);
ti=im+iw;
printf("\n Total illiterates = %d",ti);
getch();
}
No comments:
Post a Comment