C++ Program
Not what you're looking for?
I know that the factorial of an integer n, written n!, is basically the product of consecutive integers 1 through n. Like, if I had 8, the factorial should be calculated 8! = 8 x 7 x 6 x 5 x 4 x 3 x 2 x 1 = 40320. How should I go about putting this program into a C++? I need a prompt to ask for and integer. I have written what I think it should look like, but need some help.
Thanks
#include<stdio.h>
int main()
{
int number,digit,factor=0;
printf("n Please enter a number:");
scanf("%d",&number);
while(number>0)
{
factor=number%10;
factor=factorxdigit;
number=number/10;
}
printf("The factor of digits is:%d",factor);
}
Purchase this Solution
Solution Summary
This posting contains answers to the given questions.
Purchase this Solution
Free BrainMass Quizzes
Inserting and deleting in a linked list
This quiz tests your understanding of how to insert and delete elements in a linked list. Understanding of the use of linked lists, and the related performance aspects, is an important fundamental skill of computer science data structures.
C++ Operators
This quiz tests a student's knowledge about C++ operators.
Javscript Basics
Quiz on basics of javascript programming language.
Word 2010: Table of Contents
Ever wondered where a Table of Contents in a Word document comes from? Maybe you need a refresher on the topic? This quiz will remind you of the keywords and options used when working with a T.O.C. in Word 2010.
Basic UNIX commands
Use this quiz to check your knowledge of a few common UNIX commands. The quiz covers some of the most essential UNIX commands and their basic usage. If you can pass this quiz then you are clearly on your way to becoming an effective UNIX command line user.