Display the output: Number Factorial 1 1 2 2 3 6 4 24 5 120
Well since it is factorial, then that means: \(\sf Number!= Number \times (number -1) \times ... \times 1\) So for example the factorial of 6 would be \(\sf 6!= 6 \times 5 \times 4 \times 3 \times 2\times 1\)
can u write the full program 4 me plx in C++
Sorry, I don't know anything about coding/programming or C++ :/
Couldn't this go in Computer Science anyway? o_O
Since this is really a dead subject, I would advise you to post your question in the Computer Science subject, as that is more lively.
^ Eggscatly
What I was just about to say @CausticSyndicalist xD
Also not to forget, Welcome to OpenStudy! @AmeerHamza
xD I swear great minds think alike. =P
thnk u @TheSmartOne
hahahaha u both r funny
Oh we do try. ;)
Np. Post your question here: http://openstudy.com/study#/groups/Computer%20Science
#include <iostream> using namespace std; int factorial (int x); int main () { cout<<"Number \tFactorial"<<endl;; int a = 1; int b = 2; int c = 3; int d = 4; int e = 5; ; cout<<a<<"\t"<<factorial(a)<<endl; cout<<b<<"\t"<<factorial(b)<<endl; cout<<c<<"\t"<<factorial(c)<<endl; cout<<d<<"\t"<<factorial(d)<<endl; cout<<e<<"\t"<<factorial(e)<<endl; return 0; } int factorial(int x) { int i; int F=1; for (i = 1; i <= x; i++) F*=i; return F; }
Thank you @data_lg2 :D
Join our real-time social learning platform and learn together with your friends!