SIMPLE INTEREST C++ program
/*WRITE A PROGRAM TO FIND SIMPLE INTEREST USING DEFAULT ARGUMENT*/
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
float interest(intp,intt,float r=0.15)
{
return (p*t*0.15);
}
void main()
{
clrscr();
int p, t, inter;
cout<<"Enter the principle";
cin>>p;
cout<<"Enter the time period in year";
cin>>t;
inter=interest(p,t);
cout<<"The interest is"<<inter;
getch();
}
----------------------------------------------------------
OUTPUT:-
#include<iostream.h>
#include<conio.h>
#include<stdio.h>
float interest(intp,intt,float r=0.15)
{
return (p*t*0.15);
}
void main()
{
clrscr();
int p, t, inter;
cout<<"Enter the principle";
cin>>p;
cout<<"Enter the time period in year";
cin>>t;
inter=interest(p,t);
cout<<"The interest is"<<inter;
getch();
}
----------------------------------------------------------
OUTPUT:-
0 comments