Program to find Simple interest.| Using C language| very Basic| C Program series 03|
👨💻Program to find Simple interest.
Code:
//Program to print simple interest.
#include<stdio.h>
void main()
{
float a,r,t,i;
//here, we declare four floating variables which contain floating values.
printf("## PROGRAM TO FIND SIMPLE INTEREST ##\n");
printf("Enter the Amount:");
scanf("%f",&a);
//%f is used for float value.
printf("Enter the Interest Rate:");
scanf("%f",&r);
printf("Enter the Time period(in year):");
scanf("%f",&t);
i=(a*r*t)/100.00;//to perform operation.
printf("\nBased on Amount:%.2f RUPEES Iterst Rate:%.2f PERCENT Time period:%.2f YEAR\n==>Simple Interest is %.2f RUPEES",a,r,t,i);
//Using printf function to display given line.
//%.2f is display the float values of variables up to 2-decimals respectively.
}
Output:
Comments
Post a Comment