1. ## command line argument

how to find a factorial of a given number through command line argument

2. can anyone tell me a code to find factorial of a given number throughcommand line argument

3. How to ask a decent question.
http://www.catb.org/~esr/faqs/smart-questions.html

If you were expecting an answer on a plate, it doesn't work like that.
Attention and help on our part depends on some effort on your part.

4. Originally Posted by csit
can anyone tell me a code to find factorial of a given number throughcommand line argument
Well, first you need to learn to use the command line arguments, this is actually not very hard at all, try to google for some tutorials on how to use argc and argv.

Then you just have to write a function that will find the factorial of a given number. This is also not very hard, if you know how to do it on paper it should be a breeze, also, the web is littered with tutorial on recursion that uses factorial calculation as an example.

Be cautious though, if the user inputs something like 160, the resulting factorial will undoubtedly cause an overflow, so check the input before going on.

Also, the command line arguments are an array of chars, so you will most likely need to convert it to a number for your function (Unless ofcourse you write it so it will accept a char), look into atoi() for this, or maybe strtol().

5. Well, first you need to learn to use the command line arguments, this is actually not very hard at all, try to google for some tutorials on how to use argc and argv.
Here's one on this very site. http://www.cprogramming.com/tutorial/c/lesson14.html

Also, the command line arguments are an array of chars, so you will most likely need to convert it to a number for your function (Unless ofcourse you write it so it will accept a char), look into atoi() for this, or maybe strtol().
There's a link for every problem. http://faq.cprogramming.com/cgi-bin/...043284385#opt3