answersLogoWhite

0

import java.math.BigInteger;

public class Factorial {

public static void main(String[] args) {

BigInteger n = BigInteger.ONE;

for (int i=1; i<=20; i++) {

n = n.multiply(BigInteger.valueOf(i));

System.out.println(i + "! = " + n);

}

User Avatar

Wiki User

15y ago

What else can I help you with?

Continue Learning about Engineering

Write the Pseudocode to find the factorial of a number?

Pseudo code+factorial


Using while loop Write a program find the factors of a number?

by this program you can find the factorial: #include&lt;iostream&gt; using namespace std; main() { int n,x,f=1; cin&gt;&gt; n; x=0; while(x&lt;n) { x++; f= f*x; } cout&lt;&lt;"factorial is"&lt;&lt;f&lt;&lt;"\n"; system("pause"); return 0; }


Program to find factorial of a number using inheritance?

/*71.PROGRAM TO FIND FACTORIAL OF A NUMBER USING RECURSION*/ #include&lt;stdio.h&gt; #include&lt;conio.h&gt; int fact(int); void main() { int n,f; clrscr(); printf("Enter number whose factorial is to be calculated: "); scanf("%d",&amp;n); if(n&gt;0) { f=fact(n); printf("factorial of %d is %d",n,f); } else printf("Factorial of numbers less than 1 does not exist"); getch(); } int fact(int n) { int facto=1; if(n&gt;1) facto=n*fact(n-1); else return 1; return(facto); }


How do you create factorial program in qbasic?

since factorial is for example , the factorial of 5 = 5 (5-1)(5-2)(5-3)(5-4) that means the last number to subtract from 5 is 4 , which is (n-1) ie the factorial of any number is (n-0)(.............)(n-(n-1)) to write this , 5 REM to calculate the factorial of any number 6 DIM fac AS INTEGER LET fac = 1 10 INPUT "enter the number to find its factorial "; a ' variable a 15 FOR b = 0 TO (a-1) 'numbers that will be subtracted from the " a" 20 c= a -b 'each number in the factorial calculation 25 fac = fac * c 'to compute each multiplication in the factorial 30 NEXT b 35 PRINT 'to leave a line 40 PRINT fac 45 END note this due to some unattained raesons works for numbers 0 to 7


How to write a program to find the delimiter matching in stacks?

== == using recursions: unsigned int Factorial( unsigned int x) { if(x&gt;0) { return ( x * Factorial(x-1)); } else { return(1); } } factorial: unsigned int Factorial( unsigned int x) { unsigned int u32fact = 1; if( x == 0) { return(1); } else { while(x&gt;0) { u32fact = u32fact *x; x--; } } }

Related Questions

Write the Pseudocode to find the factorial of a number?

Pseudo code+factorial


Write a program in java to find factorial of a number?

I suggest to use a for loop, more or less like this (assuming the parameter is "n"): product = 1; for (int i = 1; i &lt;= n; i++) { product *= i; }


Using while loop Write a program find the factors of a number?

by this program you can find the factorial: #include&lt;iostream&gt; using namespace std; main() { int n,x,f=1; cin&gt;&gt; n; x=0; while(x&lt;n) { x++; f= f*x; } cout&lt;&lt;"factorial is"&lt;&lt;f&lt;&lt;"\n"; system("pause"); return 0; }


Write a sell program to find the factorial of a number?

#file.sh#run as sh file.shecho "Enter the no."read ni=nr=1while [ $i -ge 1 ]dor=`expr $r \* $i`i=`expr $i-1`doneecho Factorial is $rIf the ans helps you,plz increase the trust point.


Jntu 2-2 oops through java answers?

write a java program to find factorial using recursive and non recursive


Write a c program to find the factorial of 125?

int main (void) { puts ("18826771768889260997437677024916008575954036487149242588759823150835\ 31563316135988668829328894959231336464054459300577406301619193413805\ 97818883457558547055524326375565007131770880000000000000000000000000\ 000000"); return 0; }


Program to find the factorial of a number using recursion?

/*program to find the factorial of a given number*/ #include&lt;stdio.h&gt; #include&lt;conio.h&gt; int fact(int); void main() { int n,c; printf("\n enter the number for which you want to find the factorial"); scanf("%d",&amp;n); c=fact(n); printf("\n the factorial of the number %d is %d",n,fact); getch(); } int fact(int n) { int k; if(n==0) return(1); else k=n*fact(n-1); return(k); }


C program to find factorial of a no?

this is a code for calculating it recursivelly: float Factorial (float n) { if (n&lt;=1) return 1.0; else return n* Factorial(n-1); }


Program to find factorial of a number using inheritance?

/*71.PROGRAM TO FIND FACTORIAL OF A NUMBER USING RECURSION*/ #include&lt;stdio.h&gt; #include&lt;conio.h&gt; int fact(int); void main() { int n,f; clrscr(); printf("Enter number whose factorial is to be calculated: "); scanf("%d",&amp;n); if(n&gt;0) { f=fact(n); printf("factorial of %d is %d",n,f); } else printf("Factorial of numbers less than 1 does not exist"); getch(); } int fact(int n) { int facto=1; if(n&gt;1) facto=n*fact(n-1); else return 1; return(facto); }


How do you create factorial program in qbasic?

since factorial is for example , the factorial of 5 = 5 (5-1)(5-2)(5-3)(5-4) that means the last number to subtract from 5 is 4 , which is (n-1) ie the factorial of any number is (n-0)(.............)(n-(n-1)) to write this , 5 REM to calculate the factorial of any number 6 DIM fac AS INTEGER LET fac = 1 10 INPUT "enter the number to find its factorial "; a ' variable a 15 FOR b = 0 TO (a-1) 'numbers that will be subtracted from the " a" 20 c= a -b 'each number in the factorial calculation 25 fac = fac * c 'to compute each multiplication in the factorial 30 NEXT b 35 PRINT 'to leave a line 40 PRINT fac 45 END note this due to some unattained raesons works for numbers 0 to 7


Write a program to find the factorial number using function?

//C program to find the factorial of a given number using functions #include&lt;stdio.h&gt; #include&lt;conio.h&gt; int fact(int); void main() { int f,t; clrscr(); printf("\nEnter any number:"); scanf("%d",&amp;f); t=fact(f); printf("1=%d",t); getch(); } int fact(int fa) { int i,fac=1,t; for(i=fa;i&gt;=2;i--) { // TO print the series printf("%dx",i); fac=i*fac; } return fac; }


Write a c program to find the factorial number?

#include&lt;stdio.h&gt; void main() { int i=1,f=1,num; clrscr(); printf("\nEnter a number:"); scanf("%d",&amp;num); while(i&lt;=num) { f=f*i; i++; } printf("\nFactorial of %d is:%d",num,f); getch(); }

Trending Questions
What hydraulic oil to be used for denyers operating room table? What is the ratio of the energy a machine delivers to the energy supplied to it? What are the five types of application you can create in visual studio 2005? Did George Crum have problems while inventing potato chips that he had to overcome? How many pylons are there in the national grid? What software would you use to create a letter? Is the applied science concerned with designing and arranging things that people use so that the people and things interact most efficiently and safel? What does the term 'downpipe' mean? What is the difference between a tool and supply? What are the small glowing particles in laser beam? How much power is needed to supply the losses associated with the production of the magnetic field in a 3-phase motor? Can solar power be used to power an aerator instead of electricity? What programming languages don't need an ide? When did Henry bell invent the steamboat? What is an example of a moving inclined plane? How is the solar cell made? How do you set an engine in its dead center position? How long will a 100 amp hour battery with an inverter run a 42 inch lcd tv? I need to know how to turn on java script for my psp 3000. it sais on YouTube when i try to play a video you either have java script turned of or you need a newer version of flash player. someone help? What is the resistance in a discman if it is connected to an 8.6V battery and draws a current of 0.9 Amperes?