Statement:
Write a program to calculate the interest of the loan.
Algorithm:
Step-1: Read a (Amount of Rs)
Step-2: Read i (Percentage of interest)
Step-3: Read y (No of year)
Step-4: e=a*i*y (Total interest)
Step-5: t=e + a(Total amount of Rs.)
Step-6: print e, t
Step-7: End
Program Listing:
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
float a,i,t,y,e;
printf("\nAmount of Rs=");
scanf("%f",&a);
printf("\nPercentage of interest =");
scanf("%f",&i);
printf("\nNo of year=");
scanf("%f",&y);
e=a*i*y/100;
t=e+a;
printf("\nTotal interest=%f",e);
printf("\n\nTotal amount you get after %f year is= %f Rs" ,y,t);
getch();
}
Output:
Amount of Rs=1000
Percentage of interest = 13
No of year=5
Total amount you get after 5 year is= 650 Rs
Total amount you get after 5 year is= 1650 Rs
Discussion:
I. It works within the number range -32767 to 32767
II. If we use long integer then it works in more than range.
III. It works in negative number.
Write a program to calculate the interest of the loan.
Algorithm:
Step-1: Read a (Amount of Rs)
Step-2: Read i (Percentage of interest)
Step-3: Read y (No of year)
Step-4: e=a*i*y (Total interest)
Step-5: t=e + a(Total amount of Rs.)
Step-6: print e, t
Step-7: End
Program Listing:
#include<stdio.h>
#include<conio.h>
void main()
{
clrscr();
float a,i,t,y,e;
printf("\nAmount of Rs=");
scanf("%f",&a);
printf("\nPercentage of interest =");
scanf("%f",&i);
printf("\nNo of year=");
scanf("%f",&y);
e=a*i*y/100;
t=e+a;
printf("\nTotal interest=%f",e);
printf("\n\nTotal amount you get after %f year is= %f Rs" ,y,t);
getch();
}
Output:
Amount of Rs=1000
Percentage of interest = 13
No of year=5
Total amount you get after 5 year is= 650 Rs
Total amount you get after 5 year is= 1650 Rs
Discussion:
I. It works within the number range -32767 to 32767
II. If we use long integer then it works in more than range.
III. It works in negative number.
No comments:
Post a Comment