Find simple interest
Algorithm
Input P(principal amount), r( Rate of interest) ,t(number of years); Output I(interest) complexity O(1) 1 Simpleinterest(p, r , t) 2 I =p*r*t; 3 Return I
Algorithm Description
Formula for calculating compound interest: Interest=principal amount *time *rate Where, P = principal amount (initial investment) r = annual nominal interest rate (as a decimal) t = number of years
C Code
//Calculate Simple interest
//Input : P(Principal Amount),r( Rate of interest),t(Time in years)
#include< stdio.h>
#include< conio.h>
int main()
{
int p,r,t;
float si,tsum1;
printf("Enter principle amount ");
scanf("%d",&p);
printf("Enter interest rate ");
scanf("%d",&r);
printf("Enter time period(years) ");
scanf("%d",&t);
si=(float)p*r*t/100;
printf("Simple interest is %.2f\n",si);
tsum1=p+si;
printf("Amount after adding simple interest is %.2f\n",tsum1);
}