c program to find simple interest with user input principle amount




The idea behind the c program to find simple interest is the formula "si = (p * r * t)/ 100.0". Here we need principle amount, rate of interest, and time.

In this c program we accept user input for the principle amount, rate of interest and time. variables in this c program we use are defined as float type.

in this c program we use 5.2 f which 5 represents the total number of digits and 2 the number of decimal points.

It is for getting a better viewing experience.

===================================================================
#include <stdio.h>
 
#include <conio.h>
 
void main()
 
{
 
   float p, r, si;
 
   int t;
 
   clrscr();
 
   printf("Enter the values of p,r and t\n");
 
   scanf ("%f %f %d", &p, &r, &t);
 
   si = (p * r * t)/ 100.0;
 
   printf ("Amount = Rs. %5.2f\n", p);
 
   printf ("Rate   = Rs. %5.2f%\n", r);
 
   printf ("Time   = %d years\n", t);
 
   printf ("Simple interest  = %5.2f\n", si);
 
}
 
 
==================================================================
OUTPUT of C program to find simple interest - Computer program
==================================================================
Enter the values of p,r and t
2000
8
3
Amount = Rs. 2000.00
Rate = Rs. 8.00%
Time = 3 years
Simple interest = 480.00