Frequently Asked Java Program 13: Factorial of a Number

preview_player
Показать описание
Topic : Factorial of a Number

Notes:
--------
A factorial is a function that multiplies a number by every number below it.

For example

5!= 5*4*3*2*1=120.
OR
5!= 1*2*3*4*5=120.

#########################
Udemy Courses:
#########################

Manual Testing+Agile with Jira Tool
************************************

Selenium with Java+Cucumber
********************************

Selenium with Python & PyTest
********************************

Selenium with python using Robot framework
****************************************

API Testing(Postman, RestAssured & SoapUI)
*****************************************

Web & API Automation using Cypress with Javascript
********************************************

Playwright with Javascript
**************************

Jmeter-Performance Testing
************************

SDET Essencials(Full Stack QA)
*************************

Appium-Mobile Automation Testing
************************************

Java Collections
*****************

Python Programming
*********************

Cucumber BDD Framework
***************************

Protractor with Javascript
***************************

####################################
Youtube Playlists:
####################################

Manual Testing & Agile
***********************

SQL
*************************

linux & Shell Scripting
**********************

Java
**********************

Selenium With Java+Cucumber
********************************

Python
********************************

Selenium With Python,Pytest&Behave
***************************************

Selenium With Python Using Robert Framework
(Web&API Testing)
*************************************************

API Testing (Postman,SoapUi,&Rest Assured)
**********************************************

Mobile App Testing Appium
****************************

Performance Testing Jmeter
*******************************

Maven,Jenkins,Git,Github,CI/CD
*******************************

SQL,DB Testing&ETL,Bigdata
*******************************

JavaScript Based Automation Tools
********************************

Selector Hub Tools
********************

GraphQL
******************

Cypress API Testing
********************

Cypress Web Testing
**********************

Playwright with Javascipt
**************************

#JavaFactorial
#FactorialProgram
#JavaCoding
#FactorialAlgorithm
#JavaBasics
#JavaBeginner
#JavaProgramming
#FactorialLogic
#CodeSnippet
#JavaFunctions
#NumberFactorial
#JavaPractice
#ProgrammingTips
#LearnJava
#FactorialTutorial
#CodingInJava
#JavaProblems
#FactorialChallenge
#JavaDevelopment
#CodingCommunity
#AlgorithmExplained
#JavaLearning
#FactorialMethod
#JavaHelp
#CodingSolutions
#FactorialTrick
#JavaQuestions
#DebuggingJava
#CodingExperts
#FactorialLoop
#JavaGuidance
#CodeDebugging
#FactorialPuzzle
#JavaInquiry
#CodingSupport
#FactorialExample
#JavaTips
#CodingKnowledge
#FactorialWalkthrough
#JavaQueries
#ProblemSolving
#JavaCommunity
#FactorialExplained
#CodingHelp
#JavaExploration
#AlgorithmInJava
#FactorialFunction
#JavaStudents
#CodingDiscussion
#JavaSolutions
Рекомендации по теме
Комментарии
Автор

Thanks sir a lot...really liked the series..please make array set of questions as well. Thanks

anshumansehgal
Автор

//using while loop
import java.util.Scanner;

public class FactorialOfANumber {
public static void main(String[] args) {
System.out.println("Enter a number :");
Scanner sc=new Scanner(System.in);
int num;
num=sc.nextInt();
int number=num;

int res=1;


while (num>0)
{
res=res*num;
num--;

}
System.out.println("Factorial of "+number+" is: "+res);
}
}

hemmishra
Автор

Good explanation. But did not cover while loop

nickthelover
Автор

Recursion would go as well public static long factorial(int number) { if(number>=1) return number*factorial(number-1); else return 1; } and SysOut factorial(5);

kennyi
Автор

very simple explanation...thaanks a lot sir

sanjayyadav-xemf
Автор

Find factorial of a big number using Big integer because if we do using int for big numbers it will stack overflow

kogilathotavijayreddy
Автор

Sir reversing number lo scanner.ani yenduku vachhindi bro

bommanareddaiah
Автор

Could have explained recursive solution as well. Mostly interviewers look for that.

anandsharma
Автор

Sir Make an video about ISTQB Fundamental level certification Details and How to prepare for it

madhukiransunkara
Автор

Sir thank you God is great Sir op promote us also please in community's post

NA-DEVIL
Автор

public class Main
{
public static void main(String[] args) {
int num=5;
long fact=1;
while(num!=0){
for(int i=1;i<=num;i++){
fact=fact*i;
}

}
}
why it is not providing correct output?

niteshwar