perl -e 'sub f { my $fu = shift; return 1 if $fu == 1; return f($fu - 1) * $fu; } print f(5), "\n";'
just paste that in to a command prompt, change the print f(5) to print f(6) or whatever you want.
bc(1)
See the manual, there is an example for factorial.
check bellow link
http://bashscript.blogspot.com/2009/10/shell-script-to-find-factorial-of.html
A program to generate N factorial results.
ncnfcj
Pseudo code+factorial
factorial using recursion style in c++ is unsigned int fact(unsigned int a) { if (a<=1) return 1; else { f*=fact(a-1); return a; } } when using looping structure factorial is unsigned int fact (unsigned int n) { unsigned int i,f=1; for(i=1;i<=n;i++) f*=i ; return f; }
If you really wanted to do this, you could simulate multiplication with repeated addition.
by this program you can find the factorial: #include<iostream> using namespace std; main() { int n,x,f=1; cin>> n; x=0; while(x<n) { x++; f= f*x; } cout<<"factorial is"<<f<<"\n"; system("pause"); return 0; }
#include <iostream> using namespace std; int main() { int i, number=0, factorial=1; // User input must be an integer number between 1 and 10 while(number<1 number>10) { cout << "Enter integer number (1-10) = "; cin >> number; } // Calculate the factorial with a FOR loop for(i=1; i<=number; i++) { factorial = factorial*i; } // Output result cout << "Factorial = " << factorial << endl;
Unix files do not rely on extensions, therefore there is no command to find them.
chutia mc,bc bhosdika
Use the 'uname -a' command. It reports on the Unix system, version, machine name, amongst other things.
Pseudo code+factorial
factorial using recursion style in c++ is unsigned int fact(unsigned int a) { if (a<=1) return 1; else { f*=fact(a-1); return a; } } when using looping structure factorial is unsigned int fact (unsigned int n) { unsigned int i,f=1; for(i=1;i<=n;i++) f*=i ; return f; }
OS-dependent.stat for unix, FindFirstFile for Windows.
#include #include using std::cin;using std::cout;using std::endl;using std::tolower;long factorial(const int& N);int main(){int N = 0; //factorial of Nchar command = 'n';do{cout > N;cout
If you really wanted to do this, you could simulate multiplication with repeated addition.
You can debug C programs using gdb on Unix.
Kat
write a java program to find factorial using recursive and non recursive
Yes, quite a bit of companies and users use unix.