In this video tutorial lets learn how we can calculate Simple Interest by making use of simple arithmetic operations.
#include<stdio.h> int main() { int p, t; float r, si; printf("Enter principal amount\n"); scanf("%d", &p); printf("Enter Rate of interest\n"); scanf("%f", &r); printf("Enter time period\n"); scanf("%d", &t); si = (p * t * r) / 100.0; printf("Simple Interest is %f\n", si); return 0; }
Output:
Enter principal amount
1000
Enter Rate of interest
14
Enter time period
2
Simple Interest is 280.000000
In above c program we are asking user to enter the values for variable a and b. You can know more about scanf() method/function in this video tutorial: Using Scanf in C Program
C Program to Calculate the Simple Interest
In this program we take input for Principal amount, rate of interest and time period from the user, and then calculate Simple Interest for those values.
Simple_Interest = ( Principal_amount * Rate_of_interest * Time) / 100.0;
This gives us Simple Interest and we output the result to the console.
For full C programming language free video tutorial list visit:C Programming: Beginner To Advance To Expert