SlideShare a Scribd company logo
1 of 6
Created by varsha
“If this program turns out helpful to you please let me know in
the comments.”
What you should know?
Concept of factorials
If else concept
Basic knowledge of python code
Factorials: Concept
 The factorial of a positive number is the product of all
numbers less than or equal to it. So…
1! = 1
2! = 1 x 2
3! = 1 x 2 x 3
4! = 1 x 2 x 3 x 4
....
100! = 1 x 2 x 3 x 4 .... 100
Python code for factorial of a no:
Notes about code:
 “Number” is my variable for storing user’s value.
 Similarly “factorial” is also a variable
 Nested if condition is used to save time
 For condition is similar to the code in C or C++ for
factorial i.e. its easy
 In the end you get a pyramid cause computer prints all
the trials and the bottom one is the answer.
Results:

More Related Content

What's hot

Sequences and Series (Mathematics)
Sequences and Series (Mathematics) Sequences and Series (Mathematics)
Sequences and Series (Mathematics) Dhrumil Maniar
 
Sequences and series
Sequences and seriesSequences and series
Sequences and seriesmstf mstf
 
Solving systems of Linear Equations
Solving systems of Linear EquationsSolving systems of Linear Equations
Solving systems of Linear Equationsswartzje
 
Systems of Linear Equations
Systems of Linear EquationsSystems of Linear Equations
Systems of Linear Equationsalrosiemae
 
Arithmetic Sequence and Series
Arithmetic Sequence and SeriesArithmetic Sequence and Series
Arithmetic Sequence and Seriesitutor
 
Test for convergence
Test for convergenceTest for convergence
Test for convergenceAyush Agrawal
 
Longest common subsequence
Longest common subsequenceLongest common subsequence
Longest common subsequenceKiran K
 
Diagonalization of Matrices
Diagonalization of MatricesDiagonalization of Matrices
Diagonalization of MatricesAmenahGondal1
 
Probability of Simple and Compound Events
Probability of Simple and Compound EventsProbability of Simple and Compound Events
Probability of Simple and Compound EventsJoey Valdriz
 
Modular arithmetic
Modular arithmeticModular arithmetic
Modular arithmeticsangeetha s
 
5.2 first and second derivative test
5.2 first and second derivative test5.2 first and second derivative test
5.2 first and second derivative testdicosmo178
 
Increasing and decreasing functions ap calc sec 3.3
Increasing and decreasing functions ap calc sec 3.3Increasing and decreasing functions ap calc sec 3.3
Increasing and decreasing functions ap calc sec 3.3Ron Eick
 
Geometric series
Geometric seriesGeometric series
Geometric seriesJJkedst
 

What's hot (20)

Inverse function
Inverse functionInverse function
Inverse function
 
Sequences and Series (Mathematics)
Sequences and Series (Mathematics) Sequences and Series (Mathematics)
Sequences and Series (Mathematics)
 
Geometric series
Geometric seriesGeometric series
Geometric series
 
Sequences and series
Sequences and seriesSequences and series
Sequences and series
 
Solving systems of Linear Equations
Solving systems of Linear EquationsSolving systems of Linear Equations
Solving systems of Linear Equations
 
Systems of Linear Equations
Systems of Linear EquationsSystems of Linear Equations
Systems of Linear Equations
 
Arithmetic Sequence and Series
Arithmetic Sequence and SeriesArithmetic Sequence and Series
Arithmetic Sequence and Series
 
Test for convergence
Test for convergenceTest for convergence
Test for convergence
 
Mathematica for Physicits
Mathematica for PhysicitsMathematica for Physicits
Mathematica for Physicits
 
Josephus problem
Josephus problemJosephus problem
Josephus problem
 
Longest common subsequence
Longest common subsequenceLongest common subsequence
Longest common subsequence
 
Diagonalization of Matrices
Diagonalization of MatricesDiagonalization of Matrices
Diagonalization of Matrices
 
Probability of Simple and Compound Events
Probability of Simple and Compound EventsProbability of Simple and Compound Events
Probability of Simple and Compound Events
 
Chapter 1 sequences and series
Chapter 1 sequences and seriesChapter 1 sequences and series
Chapter 1 sequences and series
 
Multiplying polynomials
Multiplying polynomialsMultiplying polynomials
Multiplying polynomials
 
Modular arithmetic
Modular arithmeticModular arithmetic
Modular arithmetic
 
5.2 first and second derivative test
5.2 first and second derivative test5.2 first and second derivative test
5.2 first and second derivative test
 
Increasing and decreasing functions ap calc sec 3.3
Increasing and decreasing functions ap calc sec 3.3Increasing and decreasing functions ap calc sec 3.3
Increasing and decreasing functions ap calc sec 3.3
 
Geometric series
Geometric seriesGeometric series
Geometric series
 
Integral calculus
Integral calculusIntegral calculus
Integral calculus
 

More from varshachhajera

Electronic spreadsheet..pptx
Electronic spreadsheet..pptxElectronic spreadsheet..pptx
Electronic spreadsheet..pptxvarshachhajera
 
Fundamentals of computer..pptx
Fundamentals of computer..pptxFundamentals of computer..pptx
Fundamentals of computer..pptxvarshachhajera
 
history of computers.pptx
history of computers.pptxhistory of computers.pptx
history of computers.pptxvarshachhajera
 
Nature of Mathematics..pptx
Nature of Mathematics..pptxNature of Mathematics..pptx
Nature of Mathematics..pptxvarshachhajera
 
Output devices and types of printers.pptx
Output devices and types of printers.pptxOutput devices and types of printers.pptx
Output devices and types of printers.pptxvarshachhajera
 
Qualities and professional comepetencies of computer science teacher.pdf
Qualities and professional comepetencies of computer science teacher.pdfQualities and professional comepetencies of computer science teacher.pdf
Qualities and professional comepetencies of computer science teacher.pdfvarshachhajera
 
Role of administration in inclusive school.pptx
Role of administration in inclusive school.pptxRole of administration in inclusive school.pptx
Role of administration in inclusive school.pptxvarshachhajera
 
Co curricular activity.pptx
Co curricular activity.pptxCo curricular activity.pptx
Co curricular activity.pptxvarshachhajera
 
Triangles and Quadrilaterals.pptx
Triangles and Quadrilaterals.pptxTriangles and Quadrilaterals.pptx
Triangles and Quadrilaterals.pptxvarshachhajera
 
Surface Area of a Right Circular Cylinder.pptx
Surface Area of a Right Circular Cylinder.pptxSurface Area of a Right Circular Cylinder.pptx
Surface Area of a Right Circular Cylinder.pptxvarshachhajera
 
Software and its types.pptx
Software and its types.pptxSoftware and its types.pptx
Software and its types.pptxvarshachhajera
 
Role of Social media in Education.pptx
Role of Social media in Education.pptxRole of Social media in Education.pptx
Role of Social media in Education.pptxvarshachhajera
 
CONTEMPORARY INDIAN SCHOOLS.pptx
CONTEMPORARY INDIAN SCHOOLS.pptxCONTEMPORARY INDIAN SCHOOLS.pptx
CONTEMPORARY INDIAN SCHOOLS.pptxvarshachhajera
 

More from varshachhajera (20)

Electronic spreadsheet..pptx
Electronic spreadsheet..pptxElectronic spreadsheet..pptx
Electronic spreadsheet..pptx
 
Career Talk_228.pptx
Career Talk_228.pptxCareer Talk_228.pptx
Career Talk_228.pptx
 
Fundamentals of computer..pptx
Fundamentals of computer..pptxFundamentals of computer..pptx
Fundamentals of computer..pptx
 
history of computers.pptx
history of computers.pptxhistory of computers.pptx
history of computers.pptx
 
Nature of Mathematics..pptx
Nature of Mathematics..pptxNature of Mathematics..pptx
Nature of Mathematics..pptx
 
Input devices.pptx
Input devices.pptxInput devices.pptx
Input devices.pptx
 
Output devices and types of printers.pptx
Output devices and types of printers.pptxOutput devices and types of printers.pptx
Output devices and types of printers.pptx
 
Qualities and professional comepetencies of computer science teacher.pdf
Qualities and professional comepetencies of computer science teacher.pdfQualities and professional comepetencies of computer science teacher.pdf
Qualities and professional comepetencies of computer science teacher.pdf
 
Role of administration in inclusive school.pptx
Role of administration in inclusive school.pptxRole of administration in inclusive school.pptx
Role of administration in inclusive school.pptx
 
Co curricular activity.pptx
Co curricular activity.pptxCo curricular activity.pptx
Co curricular activity.pptx
 
SWOC analysis.docx
SWOC analysis.docxSWOC analysis.docx
SWOC analysis.docx
 
Unit analsysis.pptx
Unit analsysis.pptxUnit analsysis.pptx
Unit analsysis.pptx
 
Triangles and Quadrilaterals.pptx
Triangles and Quadrilaterals.pptxTriangles and Quadrilaterals.pptx
Triangles and Quadrilaterals.pptx
 
Surface Area of a Right Circular Cylinder.pptx
Surface Area of a Right Circular Cylinder.pptxSurface Area of a Right Circular Cylinder.pptx
Surface Area of a Right Circular Cylinder.pptx
 
Software and its types.pptx
Software and its types.pptxSoftware and its types.pptx
Software and its types.pptx
 
Computer Network.pptx
Computer Network.pptxComputer Network.pptx
Computer Network.pptx
 
Computer Memory.pptx
Computer Memory.pptxComputer Memory.pptx
Computer Memory.pptx
 
Role of Social media in Education.pptx
Role of Social media in Education.pptxRole of Social media in Education.pptx
Role of Social media in Education.pptx
 
Basics of HTML..pptx
Basics of HTML..pptxBasics of HTML..pptx
Basics of HTML..pptx
 
CONTEMPORARY INDIAN SCHOOLS.pptx
CONTEMPORARY INDIAN SCHOOLS.pptxCONTEMPORARY INDIAN SCHOOLS.pptx
CONTEMPORARY INDIAN SCHOOLS.pptx
 

Recently uploaded

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxNirmalaLoungPoorunde1
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Celine George
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon AUnboundStockton
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxUnboundStockton
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17Celine George
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxpboyjonauth
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaVirag Sontakke
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfUjwalaBharambe
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPCeline George
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptxVS Mahajan Coaching Centre
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupJonathanParaisoCruz
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.arsicmarija21
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfMahmoud M. Sallam
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitolTechU
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...Marc Dusseiller Dusjagr
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdfssuser54595a
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTiammrhaywood
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersSabitha Banu
 

Recently uploaded (20)

Employee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptxEmployee wellbeing at the workplace.pptx
Employee wellbeing at the workplace.pptx
 
Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17Difference Between Search & Browse Methods in Odoo 17
Difference Between Search & Browse Methods in Odoo 17
 
Crayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon ACrayon Activity Handout For the Crayon A
Crayon Activity Handout For the Crayon A
 
Blooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docxBlooming Together_ Growing a Community Garden Worksheet.docx
Blooming Together_ Growing a Community Garden Worksheet.docx
 
How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17How to Configure Email Server in Odoo 17
How to Configure Email Server in Odoo 17
 
Introduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptxIntroduction to AI in Higher Education_draft.pptx
Introduction to AI in Higher Education_draft.pptx
 
ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)ESSENTIAL of (CS/IT/IS) class 06 (database)
ESSENTIAL of (CS/IT/IS) class 06 (database)
 
Painted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of IndiaPainted Grey Ware.pptx, PGW Culture of India
Painted Grey Ware.pptx, PGW Culture of India
 
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdfFraming an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
Framing an Appropriate Research Question 6b9b26d93da94caf993c038d9efcdedb.pdf
 
What is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERPWhat is Model Inheritance in Odoo 17 ERP
What is Model Inheritance in Odoo 17 ERP
 
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions  for the students and aspirants of Chemistry12th.pptxOrganic Name Reactions  for the students and aspirants of Chemistry12th.pptx
Organic Name Reactions for the students and aspirants of Chemistry12th.pptx
 
9953330565 Low Rate Call Girls In Rohini Delhi NCR
9953330565 Low Rate Call Girls In Rohini  Delhi NCR9953330565 Low Rate Call Girls In Rohini  Delhi NCR
9953330565 Low Rate Call Girls In Rohini Delhi NCR
 
MARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized GroupMARGINALIZATION (Different learners in Marginalized Group
MARGINALIZATION (Different learners in Marginalized Group
 
AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.AmericanHighSchoolsprezentacijaoskolama.
AmericanHighSchoolsprezentacijaoskolama.
 
Pharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdfPharmacognosy Flower 3. Compositae 2023.pdf
Pharmacognosy Flower 3. Compositae 2023.pdf
 
Capitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptxCapitol Tech U Doctoral Presentation - April 2024.pptx
Capitol Tech U Doctoral Presentation - April 2024.pptx
 
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
“Oh GOSH! Reflecting on Hackteria's Collaborative Practices in a Global Do-It...
 
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
18-04-UA_REPORT_MEDIALITERAСY_INDEX-DM_23-1-final-eng.pdf
 
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPTECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
ECONOMIC CONTEXT - LONG FORM TV DRAMA - PPT
 
DATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginnersDATA STRUCTURE AND ALGORITHM for beginners
DATA STRUCTURE AND ALGORITHM for beginners
 

Factorial of a number in python

  • 1. Created by varsha “If this program turns out helpful to you please let me know in the comments.”
  • 2. What you should know? Concept of factorials If else concept Basic knowledge of python code
  • 3. Factorials: Concept  The factorial of a positive number is the product of all numbers less than or equal to it. So… 1! = 1 2! = 1 x 2 3! = 1 x 2 x 3 4! = 1 x 2 x 3 x 4 .... 100! = 1 x 2 x 3 x 4 .... 100
  • 4. Python code for factorial of a no:
  • 5. Notes about code:  “Number” is my variable for storing user’s value.  Similarly “factorial” is also a variable  Nested if condition is used to save time  For condition is similar to the code in C or C++ for factorial i.e. its easy  In the end you get a pyramid cause computer prints all the trials and the bottom one is the answer.