Input :
Principal (P) : 1500
Time (T) : 2
Rate (R) : 3.5
Output:
Simple Interest: 105
Here we learn, how to calculate simple interest by using C language.
Principal (P) : 1500
Time (T) : 2
Rate (R) : 3.5
Output:
Simple Interest: 105
Algorithm to Calculate Simple Interest:
Step 1: Start
Step 2: Read Principal Amount, Time and Rate.
Step 3: Calculate Interest using formula SI=(Principal*Time*Rate)/100
Step 4: Print Simple Interest.
Step 5: End
Step 2: Read Principal Amount, Time and Rate.
Step 3: Calculate Interest using formula SI=(Principal*Time*Rate)/100
Step 4: Print Simple Interest.
Step 5: End
FlowChart to Calculate Simple Interest:
Here we learn, how to calculate simple interest by using C language.
/* C program to calculate simple interest given principal,
* time and rate of interest.
*/
#include <stdio.h>
#include <conio.h>
void main()
{
float principal,rate,SI;
int time;
clrscr();
// Input principle amount
printf("\n Enter the principal amount : ");
scanf("%f",&principal);
// Input time
printf("\n Enter time : ");
scanf("%d",&time);
// Input rate of interest
printf("\n Enter rate of interest : ");
scanf("%f",&rate);
// Calculate Simple interest
SI = (principal * time * rate) / 100.0;
// Print the Simple Interest
printf("\n The Simple Interest : %f", SI);
getch();
}
OUTPUT:
Enter the principal amount : 10000
Enter time : 5
Enter rate of interest : 3.5
The Simple Interest : 1750.00
Enter time : 5
Enter rate of interest : 3.5
The Simple Interest : 1750.00
No comments:
Post a Comment