By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
454,382 Members | 1,674 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 454,382 IT Pros & Developers. It's quick & easy.

factorial

P: 1
write a program to find the factorial of a given number with out using any pointers and functions
Jun 1 '07 #1
Share this Question
Share on Google+
4 Replies


Ganon11
Expert 2.5K+
P: 3,652
The experts on this site are more than happy to help you with your problems but they cannot do your assignment/program for you. Attempt the assignment/program yourself first and post questions regarding any difficulties you have or about a particular function of the code that you don't know how to achieve.

Please read the Posting Guidelines and particularly the Coursework Posting Guidlines.

Then when you are ready post a new question in this thread.

MODERATOR
Jun 1 '07 #2

P: 93
write a program to find the factorial of a given number with out using any pointers and functions
Use a Iterative statement.
Accept the number from user for which you need Factorial.(try with printf scanf or with cin, cout).
then put a for loop with a initial variable value as 1 and final value as given by
the user. go on incrementing with a step of 1.
have a result variable assigned to 1 at the beginning.
Go on multiplying this result variable with loop variable and store the answer
in result variable.

Once after comming out of this for loop, result variable contains the
factorial of the entered number.

Regards,
Girish.
Jun 1 '07 #3

Banfa
Expert Mod 5K+
P: 8,916
write a program to find the factorial of a given number with out using any pointers and functions
Not possible, you will as a minimum have to define main which is a function so you will have to use a minimum of 1 function.
Jun 1 '07 #4

100+
P: 208
Not possible, you will as a minimum have to define main which is a function so you will have to use a minimum of 1 function.
My guess is they're not counting main() as a function (which is wrong).
Jun 1 '07 #5

Post your reply

Sign in to post your reply or Sign up for a free account.