C PROGRAM TO CALCUATE INTEREST AND TOTAL AMOUNT AT THE END OF EACH YEAR

Thursday, July 2, 2009 Leave a Comment


//Note: Output is not in the form of table and rate is taken as 2%. It calculates amount of each year

#include <stdio.h>
#include <conio.h>
void main()
{
int t=1;
int r=2;
int y;
int y1=0;
long int p,a;
float i1;
double total;;
clrscr();
printf("enter starting amount&year");
scanf("%ld""%d",&p,&y);
while(y1<2009)
{
printf("enter current year");
scanf("%d",&y1);
printf("enter amount to be deposited");
scanf("%ld",&a);
i1=(p*r*t)/100;
total=i1+a+p;
printf("1%d",y);
printf("starting amount is %ld",p);
p=p+a;
printf("current year is %d",y1);
printf("interest is %f",i1);
printf("total amount is %lf",total);
}
getch();
}

Related Posts :



0 comments »

Leave your response!