C program to calculate simple interest
Simple interest is calculated by using SI=(P*T*R)/100 formula
Where,
SI is a simple interest
P is the principal amount
T is time (In years)
R is the rate of interest
C program to calculate simple interest (when time is in year)
|
#include<stdio.h> #include<conio.h> void main() { float p, t, r, si; // taking input of principal printf("\n Enter the value of
principle amount:"); scanf("%f",&p); // taking input of time printf("\n Enter Time (In
year):"); scanf("%f", &t); // taking input of rate printf("\n Enter rate percent:"); scanf("%f",&r); // Using formula of simple interest si = (p*t*r)/100; // printing simple interest printf("\n Simple interest = %f", si); getch(); } |
C program to calculate simple interest (when time is in a month)
|
#include<stdio.h> #include<conio.h> void main() { float p, t, r, si; // taking input of principal printf("\n Enter the value of
principle amount:"); scanf("%f",&p); // taking input of time printf("\n Enter Time (In
month):"); scanf("%f", &t); // taking input of rate printf("\n Enter rate percent:"); scanf("%f",&r); // converting time month into year and using simple interest
formula si = (p*t*r)/1200; // printing simple interest printf("\n Simple interest = %f", si); getch(); } |
|
#include<stdio.h> #include<conio.h> void main() { float p, t, r, si; // taking input of principal printf("\n Enter the value of
principle amount:"); scanf("%f",&p); // taking input of time printf("\n Enter Time (In
days):"); scanf("%f", &t); // taking input of rate printf("\n Enter rate percent:"); scanf("%f",&r); // converting time days into year and using simple interest
formula si = (p*t*r)/36500; // printing simple interest printf("\n Simple interest = %f", si); getch(); } |




0 Comments
Please do not enter any spam link on comment box