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
Post a Comment