Thursday, October 16, 2014

find simple interest and take value of n as default argument in C++



 Write a program to find simple interest and take value of n as default argument

#include<iostream.h>
#include<conio.h>
float interest(float p,float r, float n=5);
float interest(float p,float r,float n)
{
float i=(p*r*n)/100;
return i;
}
void main()
{
float p,r;
cout<<"\n enter the value of P";
cin>>p;
cout<<"\n enter the value of R";
cin>>r;
cout<<"\n the simple interest is  ";
cout<<interest(p,r);
getch();
}




No comments: