In this tutorial, we are going to learn the writing program in c to calculate the Simple Interest. Simple Interest is a mathematical term and we have a mathematical formula for this calculation.
Before starting writing the program let’s understand simple interests.
What is Simple Interest?
Simple interest is a method to calculate the interest charged on a loan. It is calculated by multiplying the interest rate by the principal by the number of days that elapse between payments.
Simple Interest Formula:
SI = (P*T*R)/100
Where,
P is principle amount
T is the time duration
R is the rate of interest
Example of how we can calculate simple interest
Input
Enter principle: 1200
Enter time: 2
Enter rate: 5.4
Output
Simple Interest = 129.600006
Logic we are following to calculate simple interest
- We are taking Principle amount, time and rate of interest as an input.
- Now after taking input we are simply calculating simple interest using formula
SI = (principle * time * rate) / 100
. - After calculating SI using above formula we are printing the value which is our program output.
Program in C to calculate Simple Interest
#include <stdio.h>
int main()
{
float p, t, r, SI;
printf("Program to calculate Simple Interest\n");
printf("Enter principle amount: ");
scanf("%f", &p);
printf("Enter time (in years): ");
scanf("%f", &t);
printf("Enter rate: ");
scanf("%f", &r);
SI = (p * t * r) / 100;
printf("Simple Interest = %.2f", SI);
return 0;
}
Output
Program to calculate Simple Interest
Enter principle amount: 1000
Enter time (in years): 3
Enter rate: 5
Simple Interest = 150.00
Also Prepare Below Important Question
- Python Program to add two number using Recursion
- Python Program to Find Highest Frequency Element in Array
- Python Program to Merge two Arrays
- Perform left rotation by two positions in Array Using Python
- Python Program to Delete Element at Given Index in Array
- Python Program to Delete element at End of Array
- Python Program to Copy one String to Another String
- Python Program to Remove Repeated Character from String
- Print highest frequency Character in String in Python
- Python Program to Convert lowercase vowel to uppercase
- Convert Celsius to Fahrenheit in Python
- Leap Year Program in Python
- Python Program to convert Decimal to Octal number
- Python Program to Convert Decimal Number into Binary
- Find all Pairs Whose Sum is Equal to Given number in Python
- Python Program to Replace First Vowel With ‘-‘ in String
- Python Program to find Prime factors of given integer
- Python Program to Print Prime Number in given range
- Java Program to Perform Left Rotation on Array Elements by Two
- Java Program to Perform Right Rotation on Array Elements by Two
Interview Questions Categories
C Programming Interview Preparation
Core Java Programming Interview Preparation
- Core Java Programming Coding Questions
- Core Java Pattern Programming Questions
- Core Java Programming Interview Questions