0

Hello.....
Where I am wrong in this program.
I am getting declaration syntax error.

#include<iostream.h>
#include<conio.h>
int factorial(int)
int main()
{clrscr();
int n,r,nr,fn,fr,fnr;
int ncr;
cout<<"/n Enter n and r = ";
cin>>n>>r;
fn=factorial(n);
fr=factorial(r);
nr=n-r;
fnr=factorial(nr);
ncr=fn/(fr*fnr);
cout<<"/n nCr ="<<n<<" C "<<r<<" = "<<ncr<<endl;
getch();
return 0;
}

Thanx

3
Contributors
3
Replies
15
Views
1 Year
Discussion Span
Last Post by __avd
0

Are you using Turbo C++ format??? The #include<iostream> should not have .h in there. The same applies to the next line.

PS: Next time, please include the exact ERROR MESSAGE you saw from your compiling process...

Edited by Taywin

-1

Thanx for reply Tayin.

I am using Turbo C++.
When I run this program it says declaration syntax error.
When I compiled this turbo c++ says "compile successfully"
It shows error message on running this program....

0

You have to define factorial() function and don't use old turboc compiler. Here you can find name of some compilers.

#include<iostream>

int factorial(int);  // function declaration

int factorial(int value)  //function definition
{
   //code
}
int main() 
{
  //code
}
This topic has been dead for over six months. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.