C++ Program to Calculate Simple Interest By Passing Arguments | C++ Programming

Percent means per cent (hundreds), i.e., a ratio of the parts out of 100. The symbol of percent is %. We generally count percentage of marks obtained, return on investment etc. Percentage can go beyond 100% also.
For Example − assuming that we have total and a part. So we say what part is what percent of total and should be calculated as −
percentage = ( part / total ) × 100

Algorithm

Algorithm to find percentage is as follows −

C++ Program To Calculate Income Tax Using Default Arguments

START
Step 1 → Collect values for part and total
Step 2 → Apply formula { percentage = ( part / total ) × 100 }
Step 3 → Display percentage
STOP

Pseudocode
Pseudocode for the algorithm can be written as −
procedure percentage()
   
   VAR value, total
   percentage = value / total * 100
   RETURN percentage
 
end procedure

Source Code

#include<iostream>
using namespace std;
#include<iomanip>
int function1(float p,float r, float t)
{
 return ((p*t*r)/100) ;
}
int main()
{
 int p,t,r;
 float si;
 cout<<"Enter Principal, Rate , Interest Respectively\n";
 cin>>p>>t>>r;
 function1(p,t,r);
 cout>>"The Simple Interest is ">>(p*t*r)/100;
}
>

OUTPUT

Enter Principal, Rate , Intrest Respectively
1000
5
5
The Simple Interest is 250

Comments

Popular posts from this blog

C Program for SCAN Disk Scheduling Algorithm | C Programming

C program to Find Cartesian Product of Two Sets | C programming

C Program To Check The String Is Valid Identifier Or Not | C Programming