C Program to Find Simple Interest

Today, we learn on C Program to Find Simple Interest.

In mathematics, we calculate simple interest by the following formula:

Simple Interest = (Principle Amount * Rate of Interest * Time)/100

Let’s understand it with C program code

Note: After understanding below code don’t forget to read program code explanation (PCE)

C Program to Find Simple Interest

#include<stdio.h>
#include<conio.h>
void main()
{
int pa,ri,t,SI;
/*Pa=Principle Amount
ri=Rate of Interest
t=time
SI=simple interest*/
clrscr();
printf("Enter principle Amount");
scanf("%d",&pa);
printf("Enter rate of interst");
scanf("%d",&ri);
printf("Enter total time in years");
scanf("%d",&t);

SI=(pa*ri*t)/100;
printf("Simple Interest =%d",SI);
getch();
}

Program Code Explanation(PCE)

In the above program code, we understand how to calculate a simple interest using C program.

Simple Interest = (Principle Amount * Rate of Interest * Time)/100

In simple maths

In the above line, you can see this is the mathematical formula to calculate simple interest. So you need 4 different variables to calculate simple interest. As I mentioned in program code (pa,ri,t and SI)

You already know that printf() function is used to display message or output on console (monitor screen) and scanf() function is used to input values through the user.

Using scanf(), we took values of principle_amount, rate_of_interest and time from the user.

If you don’t know the basic structure of the C programming click on below link:

Hope that you understand the above code easily. If you find any difficulty to understand above code; ask your queries via below comment section.

You can also read my other tech blog where I write about WordPress and Its elements: Zerootech

Leave a Comment

Show Buttons
Hide Buttons