0% found this document useful (0 votes)
86 views2 pages

Q. Write An Interactive Program To Calculate Compound Interest

The document contains code for C programs to calculate compound interest and simple interest. The compound interest program takes principal, interest rate, and time as input, uses a formula involving powers to calculate compound interest, and prints the result. The simple interest program similarly takes principal, rate, and time as input, uses a formula of principal × rate × time/100 to calculate simple interest, and prints the output. Both programs output the calculated interest amount.

Uploaded by

babji049
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
86 views2 pages

Q. Write An Interactive Program To Calculate Compound Interest

The document contains code for C programs to calculate compound interest and simple interest. The compound interest program takes principal, interest rate, and time as input, uses a formula involving powers to calculate compound interest, and prints the result. The simple interest program similarly takes principal, rate, and time as input, uses a formula of principal × rate × time/100 to calculate simple interest, and prints the output. Both programs output the calculated interest amount.

Uploaded by

babji049
Copyright
© Attribution Non-Commercial (BY-NC)
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOC, PDF, TXT or read online on Scribd
You are on page 1/ 2

Session 1 Q. Write an interactive program to calculate compound interest. Ans. /*c program for calculate compound interest*/ #include<stdio.

h> #include<math.h> #include<conio.h> int main() { float p,rate,time,ci; printf("Enter principal amount : "); scanf("%f", &p); printf("Enter interest rate : "); scanf("%f", &rate); printf("Enter time period in year : "); scanf("%f", &time); //calculate ci ci=p*(pow((1+rate/100),time)-1); printf("\nCompound interest = %f",ci); return 0; } Output :Enter principal amount : 48500 Enter interest rate : 6 Enter time period in year : 2 Compound interest = 5994.600098 Q. Write an interactive program to calculate simple interest. Ans. /*c program for calculate simple interest*/ #include<stdio.h> #include<conio.h> int main() { float p,rate,time,si; printf("Enter principal amount : "); scanf("%f", &p); printf("Enter rate of interest : "); scanf("%f", &rate); printf("Enter time period in year : ");

scanf("%f", &time); /*calculating simple interest*/ si=(p*time*rate)/100; printf("\nSimple Interest = %2f",si); getch(); return 0; } Output :Enter principal amount : 1000 Enter rate of interest : 2 Enter time period in year : 1 Simple Interest =20

You might also like