Calculate Simple Interest in C Programming

Hey guys, what’s up? My last tutorial was about Calculate circumference, area and perimeter in C. Here is a quick program which shows how to calculate simple interest in C. You can try it using Turbo C & check it out. This is the a problem from Chapter 1: Getting Started of the book, “Let us C” by “Yashwant Kanetkar”. Do let us know if you have any doubts or suggestions in the comments section below.

Question

The principal amount, number of years & rate of interest is 2000, 4 & 4 respectively. The formula for calculating interest is p*n*r / 100. Find Simple Interest using C Program.

Solution to Calculate Simple Interest in C Programming

First, you need to declare four variables for amount, number of years, rate & interest. Here, we are gonna name the variables p for Principal, n for number of years, r for the rate of interest and si for Simple Interest. Next we assign the values to our three variables, p, n and r. Use the formula p*n*r/100 and store the result in the variable for interest i.e si. Lastly, display the calculated simple interest using the prinf() function.

Download the solution:

Download Program

Source Code

#include<stdio.h>
#include<conio.h>
 void main()
 {
 int p,n,r,si;
 clrscr();
 p=2000; //principal amount
 n=4; //number of years
 r=4; // rate of interest
 si= p*n*r/100; //formula
 printf("Simple interest is %d",si);
 getch();
 }

 

Output

Simple interest is 320

Download the solution:

Download Program

Let us know if you need any help with the above program. You can also request a different question using our comments section or contact form and we will try our best to provide you a solution to your queries. Alternatively, you can also contact us on our social media pages.

Read Also:

Introduction to C Programming

Calculate gross salary in C

Subtracting two numbers in C

Multiplying two numbers in C

cc programc programmingDevdevelopereducationLet us C
Comments (0)
Add Comment