C++ Program to find the Factorial of a Number using For Loop
Вставка
- Опубліковано 18 жов 2024
- In this video you will learn to write a C++ Program to find the factorial of a number using For Loop ( Iterative Method ).
The factorial of a positive integer n, which is denoted as n!, is the product of all positive integers less than or equal to n.
That is n! = n * (n-1)*(n-2)*....*3*2*1
So 4! = 4 * 3 * 2 * 1 which is equal to 24.
Factorial for the numbers 0 and 1 is 1. That is 0! = 1 and 1! = 1. For negative numbers factorial value doesn't exists.
C++ Program to Find the Factorial of a number using Recursion ( Recursive Method )
• C++ Program to find th...
Get the Source Code of this tutorial at
www.ExamplePro...
our Social Media Pages
/ exampleprogram
/ exampleprogram
/ example_program
#CppProgramming #ExampleProgram
This platform shows me this video today, and last week I was struggling to do this. Finally, could do, but I'm glad to see another solution tiny different from mine.
glad my video helped you :)
Thanks for improving my problem.
Awesome tutorial. This was one of the problems my professor asked and you explained it perfectly. Thanks a lot
You are welcome!
Great tutorial, I'm confused about one thing though. In all of the examples I've seen including yours the initial value of (counter = number). And it always ends up being the correct answer.
However when I try this, it will instead give the result of the factorial * the original number, so I have to put (counter = number -1) to get the correct answer. Which makes sense since without the -1 it would essentially be multiplying num with itself first. Which is why it's so confusing on how this is working on your and other people's ends
Thanks You have explained Correctly.
You are welcome
Thanks bro your video really helped me to make my first factorial program
Glad I could help
Amazing video ever 🎉 first time I watch your video sir it’s amazing
Thank you :)
What input should I use for zero?
incredible explanation
Glad you think so!
My dear Learning Lad❤❤❤
What can I do for larger numbers? I used long long but it didn't work.
which app do you use to run the code
Vs code
Thank you sir, it helped!
You're welcome!
Thank you 💞💞
Most welcome
more perfect an easier than the rest of the tutorials
Thank you
Superb
Thanks 🤗
What about factorials in permutations?
thanks sir
most welcome :)
Where do you get this vs code theme?
available by default
Vs code
what his compiler name ??
gcc
i cant get it to work with large numbers like 20 how do i do that please help
hi sir. plz make video on program description with shamil's memory table.
why factorial = 1 in declaraton please
Sorry for late reply.
For numbers 0 and 1 the factorial value is 1
Initialising factorial with 1 will work nicely with the logic used in this program.
I like his accent
Why fact=1 what if we give 2 3 etc...
Where is output???
Hello sir
Hello
Where are you from?
Karnataka
But it find fac of 45 how it will display
bruh it ain't work
for(int counter = number ; counter > 0 ; --counter)
his for loop was wrong
This isn't a while loop thou
What is the name of the software or apk
Vs code
I got nothing
Check your code
I cant see nothing
I am sick of people using imaginary numbers in these examples, im a noob use actual number not m
bruh it isn't working. lol