Write A Program To Calculate Simple Interest In C++



C Program To Calculate Compound Interest

Calculate

C Program to Calculate Simple Interest by Given Principle, Rate of Interest and Time - Simple interest is calculated by, sinterest=principle.time.rate/100 formula. Programming C Tutorials C Programs C Practice Tests New. Simple interest is calculated as (principal amount. time. rate) / 100. So, we need four variables that will store the value of the principal amount, time, rate, and interest. In this C program to calculate simple interest, We define four variables p, t, r, and interest which stores principal amount, time, rate, and interest respectively. Let us learn how to calculate simple interest in C programming language. We have enlisted two different methods to find simple interest and amount associated with it. The first method calculates simple interest without using function and the second method has a user – defined function to find the Simple Interest. Simple C Program Write a program to calculate the simple interest. Write a program to calculate the simple interest NusratSahib.com Tweet; Share; Share; Share; Share; Related Post. Next This is the current newest page. Previous Next Post » C Tutorials. Advertisement Home: Introduction to C.

Let us learn how to write a program to calculate Compound Interest in C programming language. This C program to find compound interest takes in values of Principal Amount, ROI and Time Period from the user.

What is Compound Interest?

C++ simple program

Compound Interest is the interest computed on the initial principal amount and also on the accumulated interest of previous periods of a deposit or a loan.

Formula To Find Compound Interest

a = p (1 + r/n) nt

where,

a = value of the returns

p = Principal Amount

Write A Program In C++ To Calculate Simple Interest Using Inline Function

r = Rate of Interest

Write A Program To Calculate Simple Interest In C++ Terms

n = Number of times that Interest is compounded each year

Write A C++ Program To Calculate Simple Interest Using Friend Function

t = Number of Years (Period)

Output

p = ₹ 5000

r = 10%

n = 12

t = 5

Compound Interest = ₹ 8226.54

Must Read: C Program To Find Simple Interest using Functions

Note: This C program to find compound interest is compiled with GNU GCC compiler and written in gEdit Editor in Linux Ubuntu operating system.

Method 1: C Program To Find Compound Interest without Function

2
4
6
8
10
12
14
16
#include<math.h>
intmain()
floatprincipal,rate_of_interest,time_period,compound_interest;
scanf('%f',&principal);
scanf('%f',&rate_of_interest);
scanf('%f',&time_period);
compound_interest=principal *(pow((1+rate_of_interest/100),time_period)-1);
printf('nCompound Interest:t%fn',compound_interest);
}

Write A C++ Program To Calculate Simple Interest Using Default Arguments

Method 2: Calculate Compound Interest in C Programming using Function

C++ Simple Programs Examples

2
4
6
8
10
12
14
16
18
20
22
#include<math.h>
floatcompound_interest(floatp,floatr,floatn)
floatinterest;
returninterest;
{
floatprincipal,rate_of_interest,time_period,result;
scanf('%f',&principal);
scanf('%f',&rate_of_interest);
scanf('%f',&time_period);
result=compound_interest(principal,rate_of_interest,time_period);
return0;

Must Read: C Program To Find LCM of Two Numbers

Output

How To Write Simple Programs

Write A Program To Calculate Simple Interest In C++

If you have any doubts or compilation errors in this C program to compute compound interest, let us know about it in the comment section below.

Write A Program To Calculate Simple Interest And Compound Interest In C++

Related