SlideShare a Scribd company logo
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

Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
Nikhil Sharma
 
Static and dynamic scoping
Static and dynamic scopingStatic and dynamic scoping
Static and dynamic scoping
NusratShaikh16
 
Data Structure in C (Lab Programs)
Data Structure in C (Lab Programs)Data Structure in C (Lab Programs)
Data Structure in C (Lab Programs)
Saket Pathak
 
Recursion
RecursionRecursion
Recursion
Abdur Rehman
 
Floyd Warshall Algorithm
Floyd Warshall AlgorithmFloyd Warshall Algorithm
Floyd Warshall Algorithm
InteX Research Lab
 
Knapsack problem using greedy approach
Knapsack problem using greedy approachKnapsack problem using greedy approach
Knapsack problem using greedy approach
padmeshagrekar
 
Array within a class
Array within a classArray within a class
Array within a class
AAKASH KUMAR
 
04 brute force
04 brute force04 brute force
04 brute force
Hira Gul
 
Analysis of algorithm
Analysis of algorithmAnalysis of algorithm
Analysis of algorithm
Rajendra Dangwal
 
Ppt bubble sort
Ppt bubble sortPpt bubble sort
Ppt bubble sort
prabhakar jalasutram
 
Time complexity
Time complexityTime complexity
Time complexity
Katang Isip
 
A study on number theory and its applications
A study on number theory and its applicationsA study on number theory and its applications
A study on number theory and its applications
Itishree Dash
 
Greedy Algorithm
Greedy AlgorithmGreedy Algorithm
Greedy Algorithm
Waqar Akram
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
Dr Shashikant Athawale
 
Pattern matching
Pattern matchingPattern matching
Pattern matching
shravs_188
 
Arrays
ArraysArrays
Job sequencing with deadline
Job sequencing with deadlineJob sequencing with deadline
Job sequencing with deadline
Arafat Hossan
 
Recursive algorithms
Recursive algorithmsRecursive algorithms
Recursive algorithms
subhashchandra197
 
Polish Notation In Data Structure
Polish Notation In Data StructurePolish Notation In Data Structure
Polish Notation In Data Structure
Meghaj Mallick
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
Muhammad Amjad Rana
 

What's hot (20)

Asymptotic notations
Asymptotic notationsAsymptotic notations
Asymptotic notations
 
Static and dynamic scoping
Static and dynamic scopingStatic and dynamic scoping
Static and dynamic scoping
 
Data Structure in C (Lab Programs)
Data Structure in C (Lab Programs)Data Structure in C (Lab Programs)
Data Structure in C (Lab Programs)
 
Recursion
RecursionRecursion
Recursion
 
Floyd Warshall Algorithm
Floyd Warshall AlgorithmFloyd Warshall Algorithm
Floyd Warshall Algorithm
 
Knapsack problem using greedy approach
Knapsack problem using greedy approachKnapsack problem using greedy approach
Knapsack problem using greedy approach
 
Array within a class
Array within a classArray within a class
Array within a class
 
04 brute force
04 brute force04 brute force
04 brute force
 
Analysis of algorithm
Analysis of algorithmAnalysis of algorithm
Analysis of algorithm
 
Ppt bubble sort
Ppt bubble sortPpt bubble sort
Ppt bubble sort
 
Time complexity
Time complexityTime complexity
Time complexity
 
A study on number theory and its applications
A study on number theory and its applicationsA study on number theory and its applications
A study on number theory and its applications
 
Greedy Algorithm
Greedy AlgorithmGreedy Algorithm
Greedy Algorithm
 
Divide and conquer
Divide and conquerDivide and conquer
Divide and conquer
 
Pattern matching
Pattern matchingPattern matching
Pattern matching
 
Arrays
ArraysArrays
Arrays
 
Job sequencing with deadline
Job sequencing with deadlineJob sequencing with deadline
Job sequencing with deadline
 
Recursive algorithms
Recursive algorithmsRecursive algorithms
Recursive algorithms
 
Polish Notation In Data Structure
Polish Notation In Data StructurePolish Notation In Data Structure
Polish Notation In Data Structure
 
Greedy Algorihm
Greedy AlgorihmGreedy Algorihm
Greedy Algorihm
 

More from varshachhajera

Electronic spreadsheet..pptx
Electronic spreadsheet..pptxElectronic spreadsheet..pptx
Electronic spreadsheet..pptx
varshachhajera
 
Career Talk_228.pptx
Career Talk_228.pptxCareer Talk_228.pptx
Career Talk_228.pptx
varshachhajera
 
Fundamentals of computer..pptx
Fundamentals of computer..pptxFundamentals of computer..pptx
Fundamentals of computer..pptx
varshachhajera
 
history of computers.pptx
history of computers.pptxhistory of computers.pptx
history of computers.pptx
varshachhajera
 
Nature of Mathematics..pptx
Nature of Mathematics..pptxNature of Mathematics..pptx
Nature of Mathematics..pptx
varshachhajera
 
Input devices.pptx
Input devices.pptxInput devices.pptx
Input devices.pptx
varshachhajera
 
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
varshachhajera
 
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
varshachhajera
 
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
varshachhajera
 
Co curricular activity.pptx
Co curricular activity.pptxCo curricular activity.pptx
Co curricular activity.pptx
varshachhajera
 
SWOC analysis.docx
SWOC analysis.docxSWOC analysis.docx
SWOC analysis.docx
varshachhajera
 
Unit analsysis.pptx
Unit analsysis.pptxUnit analsysis.pptx
Unit analsysis.pptx
varshachhajera
 
Triangles and Quadrilaterals.pptx
Triangles and Quadrilaterals.pptxTriangles and Quadrilaterals.pptx
Triangles and Quadrilaterals.pptx
varshachhajera
 
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
varshachhajera
 
Software and its types.pptx
Software and its types.pptxSoftware and its types.pptx
Software and its types.pptx
varshachhajera
 
Computer Network.pptx
Computer Network.pptxComputer Network.pptx
Computer Network.pptx
varshachhajera
 
Computer Memory.pptx
Computer Memory.pptxComputer Memory.pptx
Computer Memory.pptx
varshachhajera
 
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
varshachhajera
 
Basics of HTML..pptx
Basics of HTML..pptxBasics of HTML..pptx
Basics of HTML..pptx
varshachhajera
 
CONTEMPORARY INDIAN SCHOOLS.pptx
CONTEMPORARY INDIAN SCHOOLS.pptxCONTEMPORARY INDIAN SCHOOLS.pptx
CONTEMPORARY INDIAN SCHOOLS.pptx
varshachhajera
 

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

CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
Nguyen Thanh Tu Collection
 
Information and Communication Technology in Education
Information and Communication Technology in EducationInformation and Communication Technology in Education
Information and Communication Technology in Education
MJDuyan
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
deepaannamalai16
 
Observational Learning
Observational Learning Observational Learning
Observational Learning
sanamushtaq922
 
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
Payaamvohra1
 
skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)
Mohammad Al-Dhahabi
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
nitinpv4ai
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
blueshagoo1
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
deepaannamalai16
 
BPSC-105 important questions for june term end exam
BPSC-105 important questions for june term end examBPSC-105 important questions for june term end exam
BPSC-105 important questions for june term end exam
sonukumargpnirsadhan
 
How to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in useHow to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in use
Celine George
 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
Celine George
 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
Iris Thiele Isip-Tan
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
nitinpv4ai
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
سمير بسيوني
 
adjectives.ppt for class 1 to 6, grammar
adjectives.ppt for class 1 to 6, grammaradjectives.ppt for class 1 to 6, grammar
adjectives.ppt for class 1 to 6, grammar
7DFarhanaMohammed
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
nitinpv4ai
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
heathfieldcps1
 
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
EduSkills OECD
 
Ch-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdfCh-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdf
lakshayrojroj
 

Recently uploaded (20)

CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
CHUYÊN ĐỀ ÔN TẬP VÀ PHÁT TRIỂN CÂU HỎI TRONG ĐỀ MINH HỌA THI TỐT NGHIỆP THPT ...
 
Information and Communication Technology in Education
Information and Communication Technology in EducationInformation and Communication Technology in Education
Information and Communication Technology in Education
 
Standardized tool for Intelligence test.
Standardized tool for Intelligence test.Standardized tool for Intelligence test.
Standardized tool for Intelligence test.
 
Observational Learning
Observational Learning Observational Learning
Observational Learning
 
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
NIPER 2024 MEMORY BASED QUESTIONS.ANSWERS TO NIPER 2024 QUESTIONS.NIPER JEE 2...
 
skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)skeleton System.pdf (skeleton system wow)
skeleton System.pdf (skeleton system wow)
 
Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10Haunted Houses by H W Longfellow for class 10
Haunted Houses by H W Longfellow for class 10
 
CIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdfCIS 4200-02 Group 1 Final Project Report (1).pdf
CIS 4200-02 Group 1 Final Project Report (1).pdf
 
HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.HYPERTENSION - SLIDE SHARE PRESENTATION.
HYPERTENSION - SLIDE SHARE PRESENTATION.
 
BPSC-105 important questions for june term end exam
BPSC-105 important questions for june term end examBPSC-105 important questions for june term end exam
BPSC-105 important questions for june term end exam
 
How to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in useHow to Fix [Errno 98] address already in use
How to Fix [Errno 98] address already in use
 
How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17How to Manage Reception Report in Odoo 17
How to Manage Reception Report in Odoo 17
 
Educational Technology in the Health Sciences
Educational Technology in the Health SciencesEducational Technology in the Health Sciences
Educational Technology in the Health Sciences
 
Bonku-Babus-Friend by Sathyajith Ray (9)
Bonku-Babus-Friend by Sathyajith Ray  (9)Bonku-Babus-Friend by Sathyajith Ray  (9)
Bonku-Babus-Friend by Sathyajith Ray (9)
 
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdfمصحف القراءات العشر   أعد أحرف الخلاف سمير بسيوني.pdf
مصحف القراءات العشر أعد أحرف الخلاف سمير بسيوني.pdf
 
adjectives.ppt for class 1 to 6, grammar
adjectives.ppt for class 1 to 6, grammaradjectives.ppt for class 1 to 6, grammar
adjectives.ppt for class 1 to 6, grammar
 
Skimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S EliotSkimbleshanks-The-Railway-Cat by T S Eliot
Skimbleshanks-The-Railway-Cat by T S Eliot
 
The basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptxThe basics of sentences session 7pptx.pptx
The basics of sentences session 7pptx.pptx
 
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
Andreas Schleicher presents PISA 2022 Volume III - Creative Thinking - 18 Jun...
 
Ch-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdfCh-4 Forest Society and colonialism 2.pdf
Ch-4 Forest Society and colonialism 2.pdf
 

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.