C program to find Simple interest and compound interest - Program and Algorithm


Algorithm:-

1.Start
2.Input the values of principal amount(p),rate(r),term(n).
3.Calculate simple interest by equation;
   SI=principal*rate*duration/100
4.Calculate compound interest by equation;
   CI=[(1+rate/100)*duration*principal]-principal
5.Display simple interest and compound interest.
6.Stop

Program:-

/*Program to calculate Simple and Compound Interest - Crazy Factzz */
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
clrscr();
int n;
float p,r,si,ci,z;
printf("\n Enter The Principal Amount,Term Of Deposit & Rate Of Insterest \n");
scanf("%f%d%f",&p,&n,&r);
si=(p*n*r/100);
z=1+r/100;
ci=((pow(z,n))*p)-p;
printf("\n Simple Interest : %5.2f \n Compound Interest : %5.2f \n",si,ci);
getch();
}

For more C programs - click here

Popular posts from this blog

Mini Militia Chat Codes - Shortforms

8051 Assembly Program Code for Sorting in Ascending Order - Keil -AT89C51