HERE'S THE PROGRAM, IT WORKS PERFECTLY ON MY COMPILER!!
BUT JUST ADJUST THE SPACINGS, THE PROBLEM'S DUE TO THIS EDITOR.....
#include<iostream.h>
#include<math.h>
void simple_int ( );
void comp_int ( );
void factorial ( ); /* Function prototypes */
void prime ( );
void main ( )
{
int ch;
char yn;
do
{
cout<<"\n\n MENU \n"; /* Displaying Menu */
cout<<"\n 1. Simple Interest ";
cout<<"\n 2. Compound Interest ";
cout<<"\n 3. Factorial ";
cout<<"\n 4. Prime no. ";
cout<<"\n\n\t Enter ur choice ... ";
cin>>ch;
switch (ch)
{
case 1: simple_int ( ); break;
case 2: comp_int ( ); break;
case 3: factorial ( ); break;
case 4: prime ( ); break;
default: cout<<"\n Invalid choice!! "; break;
}
cout<<"\n\n\n Continue (y/n)?? ... ";
cin>>yn;
}
while ( (yn=='y')||(yn=='Y') );
/* end of do-while loop and main */
}
void simple_int ( )
{
float p, r, t, si;
cout<<"\n\n Enter Principal in Rs. ";
cin>>p;
cout<<"\n Enter time in years ";
cin>>t;
cout<<"\n Enter rate per year ";
cin>>r;
si = p*r*t/100; /* Calculating Simple Interest */
cout<<"\n\n The Simple Interest is Rs. "<<si;
}
void comp_int ( )
{
float p, r, ci;
int t;
cout<<"\n\n Enter Principal in Rs. ";
cin>>p;
cout<<"\n Enter time in years ";
cin>>t;
cout<<"\n Enter rate per year ";
cin>>r;
ci = p* pow(( 1 + r/100 ), t);
/* Calculating Compound Interest */
cout<<"\n\n The Compound Interest is Rs. "<<ci;
}
void factorial ( )
{
int f = 1;
int i, n;
cout<<"\n\n Enter the no.whose factorial is 2 b found \n";
cin>>n;
for (i=1; i<=n; i++)
f = f*i; /* Finding the factorial */
cout<<"\n\n "<<n<<" ! = "<<f;
}
void prime ( )
{
int c, i, n;
c = 0;
cout<<"\n\n Enter the number ";
cin>>n;
for (i=1; i<=n; i++)
{
if ( n%i == 0 )
c++; /* Checking 4 any divisors */
}
if ( c==2 )
cout<<"\n "<<n<<" is a prime number. ";
else
cout<<"\n "<<n<<" is not a prime number. ";
}
RATE !!

HERE'S THE PROGRAM, IT WORKS PERFECTLY ON MY COMPILER!!
BUT JUST ADJUST THE SPACINGS, THE PROBLEM'S DUE TO THIS EDITOR.....
#include<iostream.h>
#include<math.h>
void simple_int ( );
void comp_int ( );
void factorial ( ); /* Function prototypes */
void prime ( );
void main ( )
{
int ch;
char yn;
do
{
cout<<"\n\n MENU \n"; /* Displaying Menu */
cout<<"\n 1. Simple Interest ";
cout<<"\n 2. Compound Interest ";
cout<<"\n 3. Factorial ";
cout<<"\n 4. Prime no. ";
cout<<"\n\n\t Enter ur choice ... ";
cin>>ch;
switch (ch)
{
case 1: simple_int ( ); break;
case 2: comp_int ( ); break;
case 3: factorial ( ); break;
case 4: prime ( ); break;
default: cout<<"\n Invalid choice!! "; break;
}
cout<<"\n\n\n Continue (y/n)?? ... ";
cin>>yn;
}
while ( (yn=='y')||(yn=='Y') );
/* end of do-while loop and main */
}
void simple_int ( )
{
float p, r, t, si;
cout<<"\n\n Enter Principal in Rs. ";
cin>>p;
cout<<"\n Enter time in years ";
cin>>t;
cout<<"\n Enter rate per year ";
cin>>r;
si = p*r*t/100; /* Calculating Simple Interest */
cout<<"\n\n The Simple Interest is Rs. "<<si;
}
void comp_int ( )
{
float p, r, ci;
int t;
cout<<"\n\n Enter Principal in Rs. ";
cin>>p;
cout<<"\n Enter time in years ";
cin>>t;
cout<<"\n Enter rate per year ";
cin>>r;
ci = p* pow(( 1 + r/100 ), t);
/* Calculating Compound Interest */
cout<<"\n\n The Compound Interest is Rs. "<<ci;
}
void factorial ( )
{
int f = 1;
int i, n;
cout<<"\n\n Enter the no.whose factorial is 2 b found \n";
cin>>n;
for (i=1; i<=n; i++)
f = f*i; /* Finding the factorial */
cout<<"\n\n "<<n<<" ! = "<<f;
}
void prime ( )
{
int c, i, n;
c = 0;
cout<<"\n\n Enter the number ";
cin>>n;
for (i=1; i<=n; i++)
{
if ( n%i == 0 )
c++; /* Checking 4 any divisors */
}
if ( c==2 )
cout<<"\n "<<n<<" is a prime number. ";
else
cout<<"\n "<<n<<" is not a prime number. ";
}
RATE !!
