satish_sudi Profile Answers by satish_sudi Jun 25th, 2007 Code #include<iostream> using namespace std; /* factorial function --recursive*/ int fact(int n){ if (n == 0) return 1; n=n*fact(n-1); return n; } int main() { int n=5; cout << "Factorial of number " << n << " is : " << fact(n) << endl; return 0; }
Sheenu Sep 27th, 2011 //program to find the factorial of a number Code#include<stdio.h> #include<conio.h> void main() { int a,fact=1; for(a=1;a<=5;a++) fact=fact*a; } printf("%d",fact); getch(); }
richa Oct 10th, 2012 Codeclass fact { public static void main (String orgs[]) { int n,fact=1; for(a=n;a>0;a--) { fact=fact*n; system.out.println("factorial of the no is"+fact); } } }
Write a program to find the Factorial of a number
Related Answered Questions
Related Open Questions