Simple Interest Calculator in C

Simple Interest Calculator in C

Introduction

Calculating simple interest is a common financial computation. This program takes principal, rate, and time as inputs to compute interest.

Program

#include <stdio.h> int main() { float principal, rate, time, interest; printf("Enter principal amount: "); scanf("%f", &principl); printf("Enter rate of interest: "); scanf("%f", &rate); printf("Enter time (in years): "); scanf("%f", &time); interest = (principl * rate * time) / 100; printf("Simple Interest = %.2f", interest); return 0; }

Explanation

  • (principal * rate * time) / 100: Formula to calculate simple interest.

  • %.2f: Formats the output to two decimal places.

Comments

Popular posts from this blog

C Program To Find Largest Number Among Three Integers

C Program To Convert Fahrenheit To Celsius

C Program To Reverse a Number