Home
About
FAQs
System Requirements
In the news
Workshops
Training
Training Calendar
Request for Training
Training Status
Registration
For Teachers
For Students
For Schools
Contact us
Login
Languages
English
हिंदी
മലയാളം
मराठी
ಕನ್ನಡ
you are here->
home
->
Class 12
->
Factorial Loop Init Error
Factorial Loop Init Error
Theory
Theory
Procedure
Simulator
Viva Voce
Reference
Feedback
Procedure
Real Lab Procedure
Creating a variable "num" to hold the number entered by the user.
Variable "fact" is used to hold the factorial of the given number, which is initialized to value 1.
Loop variable "i" is initialized to the value 0 (by an error).
"while" loop is used to calculate the factorial of the given number.
"while" loop will execute until "i" is less than or equal to the given number.
Inside "while" loop, two important operations are carried out:
fact = fact * i
i = i + 1
Print the factorial of the given number when exiting from the "while" loop.
Simulator Procedure
Enter the input values.
Click on the Submit button.
Select the variables from the dropdown list.
Click on the Finish button or Start button to view the state diagram.
If you have clicked on the Start button, then use the Next and Previous buttons to view the state diagram.
Click on the Reset button when the State diagram is completed.