You are currently viewing Simple Interest Calculator using C++ (With Source Code)

Simple Interest Calculator using C++ (With Source Code)

Creating a Simple Interest Calculator using C++ (With Source Code)

Hello, coders. Welcome to the codewithrandom blog. In this article, we will learn how to create a a Simple Interest Calculator using C++ (With Source Code).

Simple Interest Calculator

A Simple Interest Calculator using C++ programming language is a program which calculates and displays the simple interest based on user-provided inputs of principal amount, interest rate, and number of years.

The C++ code uses user input, basic arithmetic operations, and a standard output stream to deliver an efficient and user-friendly experience. This simple interest calculator is useful for financial planning and budgeting.

Creating an Address Book Project in C++ (Source Code)

It is a straightforward system which is easy to use and create. It has a basic interface. It helps the user to calculate the interest in an efficient manner.

Features of the Interest Calculator:

  • The program asks user to enter the principal amount, interest rate, and number of years.
  • The user’s inputs are stored in the respective variables.
  • Formula used to calculate simple interest – (principal_amount * interest_rate * number_of_years) / 100.
  • The program displays the calculated simple interest value to the user.

Overview of the UI:

Plz enter your principal amount:
Enter your interest rate:
Enter number of years:
Your simple interest value is:
Simple Interest Calculator

 

User will then enter a values according to the prompts that will be displayed on the console to perform the operation.

Simple Interest Calculator Source code:

You can directly use this code by copying it in your IDE to understand the working and then can create it by understanding the project.

#include <iostream>
using namespace std;
int main() {
    int princi_amnt;
    float int_rate;
    float num_of_years;
    float sim_int;
    cout << "Plz enter your principal amount: " ;
    cin >> princi_amnt;

    cout << "Enter your interest rate: ";
    cin >> int_rate;
    cout << "Enter number of years: ";
    cin >> num_of_years;

    sim_int = (princi_amnt * int_rate * num_of_years) / 100;
        cout<<"Your simple interest value is: " << sim_int;  //prints simple interest value
    return 0;
}

Now let us understand the code:-

  • We will start by writing the header of the code with the required libraries – iostream  (input and output stream).
  • The main() function is the entry point of the program. We will declare the variable to store the details entered by the user. The variables are – princi_amnt (principal amount), int_rate (interest rate), num_of_years (number of years), sim_int (simple interest).
  • Now we will use cout object to request the user to enter the primary amount, and the cin object is used to accept the input. The value is saved in the variable princi_amnt.
  • Similarly, the program prompts the user for the interest rate and the number of years, and the values are saved in the appropriate variables.
  • The simple interest is calculated using the formula (princi_amnt * int_rate * num_of_years) / 100 and assigned to the variable sim_int.
  • We will use the cout object to show the computed simple interest value along with an appropriate message.
  • Finally, the return 0; statement shows that the program has completed correctly and ends it.

Clinic Management System in C++ | Codewithrandom

Final Output:-

Here is an example to show how this project works.

Simple Interest Calculator

Simple Interest Calculator

Video Output:

Here we will provide you with the working video our simple interest calculator . We are going to show you the video for calculating the simple interest using common data.

 

Conclusion

We have reached the end of this article and have a lot more projects in C++ coming so stay tuned. We have started with awesome and fun projects for you all to understand C++. Learning C++ by creating fun projects makes learning easy and interesting.

Electricity Bill Generator Project In C++(Source Code)

If you enjoyed the article and learned something new today, let us know in the comments.

Thank you.

Happy Reading! 🙂

Follow: CodeWithRandom



Leave a Reply