Beta Coder

Learn code like Beta Coder.

Breaking

Sunday, June 21, 2020

C Program to Calculate Simple Interest

CALCULATE SIMPLE INTEREST

C Program to Calculate Simple Interest

In this program we learn using C how to calculate simple interest given principal amount, time and rate of interest which is provided by user.
Formula And Example for simple interest

Example:

 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.

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

FlowChart to Calculate Simple Interest:

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

No comments:

Post a Comment