Compute simple interest using C


Levels of difficulty: / perform operation:

C program to compute simple interest and compound interest from the given principal, time period and interest rate.

C Program

#include <stdio.h>
#include <conio.h>
#include <math.h>
void main()
{
	int p,t;
	float si,ci,r,i;
	clrscr( );
	printf("\nENTER PRINCIPAL: ");
	scanf("%d",&p);
	printf("\nENTER TIME PERIOD: ");
	scanf("%d",&t);
	printf("\nENTER RATE OF INTEREST: ");
	scanf("%f",&r);
	si=(p*t*r)/100;
	i=r/100;
	ci=p*pow((1+i),t);
	printf("\nSIMPLE INTEREST: %0.2f",si);
	printf("\n\nCOMPOUND INTEREST: %0.2f",ci);
	getch();
}


Output







Quantitative Aptitude
Reasoning
Programming
Interview