Program to find interest using if statement.

Using Visual Studio 2015


===============================================================

#include<iostream>
using namespace std;
#include<conio.h>
void main()
{

int input;

label:

cout <<"\nEnter current year=";

cin>>input;

input = input - 1991;

cout<<"\nyears=";

cout<<input;


if (input >= 0)

{
 
if (input >= 5)
 
{
     
input/=5;
  
input*=1000;
  
cout<<"\nThe interest is=";
  
cout<<input;
  }
 
else
 
{
  cout<<"\nerror";
          }
 }

 else
 {
 
cout<<"\nerror";
 
goto label;
 }
_getche();
}

=========================================================================

It is a program to find interest of almost 25 years. You can change the amount of interest by doing some alterations in the formula. For example, "Input*=1200".

Comments

Popular posts from this blog

Suppose you are given a square matrix of size n x n, write a program to determine if this is an identity matrix. 2D array

Program to create a multiplication table of a given number using while loop.

Program to find equal values using if statement in C++