The following C Program is to Calculate Compound Interest.In this, p is principal amount, t is time, r is rate of interest and amt is total amount and ci is compound interest
#include<stdio.h>
#include<conio.h>
#include<math.h>
void main()
{
/* variable declaration part */
int p,t;
float r,amt,ci;
clrscr();
printf(“Enter Principal Amount -> “);
scanf(“%d”,&p);
printf(“Enter Time -> “);
scanf(“%d”,&t);
printf(“Enter Rate of interest-> “);
scanf(“%f”,&r);
amt= p*pow((1+r/100),t); //pow is inbuilt function
ci = amt-p;
printf(“\nSimple interest :-> %7.2f \n”,ci);
printf(“Total amount :-> %7.2f \n”,amt);
getch();
}
Latest posts by Mohit Arora (see all)
- MongoDB Operators Tutorial – What are Different Operators Available? - October 5, 2019
- MongoDB Projection Tutorial : Return Specific Fields From Query - March 9, 2019
- MongoDB Index Tutorial – Create Index & MongoDB Index Types - July 6, 2018