📚 Learn how to solve problems and build projects with these Free E-Books ⬇️ C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook 🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/ Experience the power of practical learning, gain career-ready skills, and start building real applications! This is a step-by-step course designed to take you from beginner to expert in no time! 💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10). Use it quickly, because it will be available for a limited time. #include using namespace std; void main() { //The factorial of a number int number; cout > number; int factorial = 1; //6!=1*2*3*4*5*6=720 //for (int i = 1; i = 1; i--) { factorial = factorial * i; } cout
Thanks a lot, I am learning from you different way to apply logic in programming. This is really helpful and I am how see different ways to solve different problems. Thanks 👍
This tutorial was very much helpful, even though i dont have any Coding background and i can easily understand your explanation and get the output seamless. Please do make a tutorial on 1.Counting vowels. 2. Reverse a string. 3.To print Fibonacci series. Thank you Mam.
Hi there, I am glad I find your brief tutorial for factorial using this for loop method. I tried & it's amazing!! But I find that the display result start to get wrong when it comes to number 13! & above. Is there any solution for this case?
Can you please make a dedicated video on 'for loop' and 'while loop' in much greater details? such as nested loops, pattern programs using loops (basic to advance level). I'm having hard time with loops especially when it comes to pattern to draw a shapes using loops. I face difficulties behind its code generation from logic.
Hey CodeBeuty, total novice here and going through your videos have made the world of code less scary! I do have one question about the for loop, in the lines: for (int i = 1; i
initialization (i=1)-->then it checks the condition(i if the condition satisfies,it executes the statement/statements between the curly braces--> then it goes to the increment/decrement part(here,i++)-->then value of i is updated-->checks condition...it goes on and on until the condition is not satisfied or you use break statement. :V
Saludos para el México y bienvenido Emiliano! 🤗 Increasing or decreasing the counter and setting the condition is considered the best practice to end the loop. However, there are other ways to terminate the execution of your loop if you really need to use them. Among those are break and goto statements, but if you make a habit of using these in large projects, you can find yourself maintaining code that is prone to bugs, very hard to understand (spaghetti code), and difficult to trace the control flow of a program. Because of that, I wouldn't encourage using them. Each time that you find yourself resorting to one of these in order to solve a problem, you should ask yourself how could you write that code without one of those, because in most cases it can be done. With that being said, there is one situation where they can be useful, and that would be for jumping out of deeply-nested loops since that would be often cleaner than using a condition variable and checking it on each level.
Wanna ask I noticed that the factorial for number beyond 12 is inaccurate which most probably due to max number of integer is 2^31.How can I modify my code so that it can calculate beyond 12?
Exactly! The number that you want to store in your int type is too big, so it cannot be stored into an int. I have talked about that in this video th-cam.com/video/solufpKPDwY/w-d-xo.html, so you can find more details there As far as I know, the long long data-type is the largest built-in integral datatype. So you can use unsigned long long int to store longer number and calculate the larger factorial. If you need an even bigger number than you'll have to use libs that are designed to work with extremely large numbers :D
Is the 3rd part (increasing/decreasing)of the For-loop always ignored on the first run? If it would just executed the conditions in the brackets after another ,the inserted number would be always In or decreased before executing the loop
Hi, this removes the negative numbers from the equation: #include using std::cout; using std::cin; using std::endl; int main() { int number, factorial = 1; cout number; if (number >= 0) { if (number == 0) cout
I noticed if I enter a letter or a symbol, the program immediately runs through the code asking to enter the pin, but doesn't allow a pin to be entered, then the program defaults to "Blocked". Is there a way to debug this? I was thinking of using another if statement
I upgraded to code to include the possibilities of the user entering 0 or a negative number you can check it out and give me tips int number; cout > number; int factorial = 1; if (number == 0) { cout
This will work. Now, here is an idea of how you can do the same thing with less code. How about reducing your code to this: int number; cout > number; int factorial = 1; if (number < 0) { cout = 1; i--) { factorial = factorial * i; } cout
📚 Learn how to solve problems and build projects with these Free E-Books ⬇️
C++ Lambdas e-book - free download here: bit.ly/freeCppE-Book
Entire Object-Pascal step-by-step guide - free download here: bit.ly/FreeObjectPascalEbook
🚀📈💻🔥 My Practical Programming Course: www.codebeautyacademy.com/
Experience the power of practical learning, gain career-ready skills, and start building real applications!
This is a step-by-step course designed to take you from beginner to expert in no time!
💰 Here is a coupon to save 10% on your first payment (CODEBEAUTY_YT10).
Use it quickly, because it will be available for a limited time.
#include
using namespace std;
void main()
{
//The factorial of a number
int number;
cout > number;
int factorial = 1;
//6!=1*2*3*4*5*6=720
//for (int i = 1; i = 1; i--) {
factorial = factorial * i;
}
cout
You are an excellent teacher! Thank you very much!
🤗🥰🥰
Your explanation is so detailed, its great. Thanks so much :D
The way you are teaching is very good..Thank you very much Saldina
Ur teaching is so beautiful 🤩
Just like YOU!!!!!
Thank you so much! 😃
Thanks a lot, I am learning from you different way to apply logic in programming. This is really helpful and I am how see different ways to solve different problems. Thanks 👍
thank you for existing 🦋
Thank you for being such a supportive and kind person 💗
This tutorial was very much helpful, even though i dont have any Coding background and i can easily understand your explanation and get the output seamless.
Please do make a tutorial on
1.Counting vowels.
2. Reverse a string.
3.To print Fibonacci series.
Thank you Mam.
Your videos are amazing! Thank you
Hi there, I am glad I find your brief tutorial for factorial using this for loop method. I tried & it's amazing!! But I find that the display result start to get wrong when it comes to number 13! & above. Is there any solution for this case?
Excellent explanation!
super helpful. thx!
i did this in class today!! :)
double recursiveFactorial(int numBer) { if (numBer == 0) return numBer; return numBer + recursiveFactorial(numBer - 1); }
excellent, your trainings are awesome
just loved your explanation))
Thank you so much!
🤗🤗
Can you please make a dedicated video on 'for loop' and 'while loop' in much greater details? such as nested loops, pattern programs using loops (basic to advance level). I'm having hard time with loops especially when it comes to pattern to draw a shapes using loops. I face difficulties behind its code generation from logic.
You are the best
Can you make more examples of for loop please 🙏
Hey CodeBeuty, total novice here and going through your videos have made the world of code less scary! I do have one question about the for loop, in the lines:
for (int i = 1; i
initialization (i=1)-->then it checks the condition(i if the condition satisfies,it executes the statement/statements between the curly braces--> then it goes to the increment/decrement part(here,i++)-->then value of i
is updated-->checks condition...it goes on and on until the condition is not satisfied or you use break statement. :V
You can think of it this way if you wish - the "for" loop works just like this implementation of a "while" loop:
int i = 1;
while (i
One day, you HAVE to teach the value outside functions it's pretty good.
Thank you ☺️
Thankxxx alot. Explained very well# keep it up.
Any examples of when you would use a factorial in a game or software?
regards from México
Saludos para el México y bienvenido Emiliano! 🤗
Increasing or decreasing the counter and setting the condition is considered the best practice to end the loop.
However, there are other ways to terminate the execution of your loop if you really need to use them.
Among those are break and goto statements, but if you make a habit of using these in large projects, you can find yourself maintaining code that is prone to bugs, very hard to understand (spaghetti code), and difficult to trace the control flow of a program.
Because of that, I wouldn't encourage using them.
Each time that you find yourself resorting to one of these in order to solve a problem, you should ask yourself how could you write that code without one of those, because in most cases it can be done.
With that being said, there is one situation where they can be useful, and that would be for jumping out of deeply-nested loops since that would be often cleaner than using a condition variable and checking it on each level.
Wanna ask I noticed that the factorial for number beyond 12 is inaccurate which most probably due to max number of integer is 2^31.How can I modify my code so that it can calculate beyond 12?
Exactly! The number that you want to store in your int type is too big, so it cannot be stored into an int.
I have talked about that in this video th-cam.com/video/solufpKPDwY/w-d-xo.html, so you can find more details there
As far as I know, the long long data-type is the largest built-in integral datatype.
So you can use unsigned long long int to store longer number and calculate the larger factorial.
If you need an even bigger number than you'll have to use libs that are designed to work with extremely large numbers :D
I remeber that you can use doble instead int to doble the capacity of your variable, you can try it.
god bless you ❤
Easy to understand
take love
Thanks a lot
Is the 3rd part (increasing/decreasing)of the For-loop always ignored on the first run? If it would just executed the conditions in the brackets after another ,the inserted number would be always In or decreased before executing the loop
to check for negative numbers I stuck in a little if else statement: if(number
Hi, this removes the negative numbers from the equation:
#include
using std::cout;
using std::cin;
using std::endl;
int main() {
int number, factorial = 1;
cout number;
if (number >= 0) {
if (number == 0)
cout
l mostly use an intializer for i when using for loops :D
How can I loop the factorial to adjust to the user input number in my for loop?
thanks, mam💕💖
How can I increase in increments , do you have a video on that maddam?
Pl.. make a video of find factorial no using recursion.
I already have that video: th-cam.com/video/MwfvXDfaZeI/w-d-xo.html
Hope it helps!😃
@@CodeBeauty Thanks Ma'am.
@@CodeBeauty Thank You So much dear.
tks
I noticed if I enter a letter or a symbol, the program immediately runs through the code asking to enter the pin, but doesn't allow a pin to be entered, then the program defaults to "Blocked". Is there a way to debug this? I was thinking of using another if statement
How can i calculate 100! ? as this programme show 100! = 0 and 20! = in negative ?
I upgraded to code to include the possibilities of the user entering 0 or a negative number you can check it out and give me tips
int number;
cout > number;
int factorial = 1;
if (number == 0)
{
cout
This will work. Now, here is an idea of how you can do the same thing with less code. How about reducing your code to this:
int number;
cout > number;
int factorial = 1;
if (number < 0)
{
cout = 1; i--)
{
factorial = factorial * i;
}
cout
CodeBeauty Thank you
I want the answer to be like for example as " 3!=3*2*1=6"... how can we do this???
#include
using namespace std;
int main(){
int num,factorial=1;
cin>>num;
while(num>0){
factorial=factorial*num;
num--;
}cout
Hello, I am entering my info but the book has not been sent to my mail.. Thanks, I am Bosnian :)
12:41 Can somebody please tell me, how did she do this? Every time I try this it comments like this: /* */. Id be happy for any advice, guys
Comment for Algor
there is a more better method wich is just do factoriel = number *(number+1)/2
For the health of your eyes and overall health i strongly advise you to change the background to a dark color.
So nice Saldina you look like million Dollar
Thank you so much