Calculate simple interest in C
scanf() - Question 14
In this question, we will see how to input principal, rate, time in C programming using the scanf() function and find the simple interest. To know more about scanf() function click on the scanf() function lesson.
Q14) Write a program in C to input principal, rate, time and find the simple interest.
Formula: Simple Interest = (Principal * Rate * Time) / 100
Program
#include <stdio.h>
#include <conio.h>
int main()
{
int p,r,t,si;
printf("Enter principal ");
scanf("%d",&p);
printf("Enter rate ");
scanf("%d",&r);
printf("Enter time ");
scanf("%d",&t);
si=(p*r*t)/100;
printf("Simple Interest=%d",si);
return 0;
}
Output
Enter principal 5000 Enter rate 10 Enter time 1 Simple Interest=500