📚 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() { //Reversing number int number, reversedNumber = 0;//321 cout > number; while (number!=0){ reversedNumber *= 10; //int lastDigit = number % 10; reversedNumber += number % 10; number /= 10; } cout
@PhantomByteAero Жыл бұрын
your code is wrong. "void main()" my app can not run it as that. How can I fix this?
@wiazowski14 жыл бұрын
Love the content and the way you are teaching. Don't stop. You are doing great. Simple and easy
@anotherryderinthestorm95684 жыл бұрын
Please keep the tutorials coming. I'll be keeping an eye out for something on arrays. Your explanations are very helpful for a new student like me. Very much appreciated! you should post a crypto address so you can more easily be compensated for your efforts. I'm glad you liked the pineapple juice suggestion.
@CodeBeauty4 жыл бұрын
Pineapple juice is the bomb! I'll definitely put more videos. It's just that I've been sick in the past 10 days, and I couldn't really speak for longer than 15-20 seconds without coughing, so filming tutorials was impossible. A new video will be up today around 6 PM UTC time. :) I'll cover arrays as well in the future! Edit: Video will be published tomorrow because I'm having problems with upload! 😕
@tan777IT5 ай бұрын
Thank you for thoroughly explaining everything step by step towards the end of the video.
@shivam_dxrk4 жыл бұрын
I didnt see the video just tried to solve the problem and came up with this, works fine upon execution #include using namespace std; int main() { int n; cout > n; while (n > 0) { int counter, f; f = n; n = n/10; counter = f - n*10; cout
@kelvinwilliams29084 жыл бұрын
I see the difference now. In both cases you want to remove the last digit but in one case (Tut12) you want to lose the digit and in the other case(Tut 13), you want to keep it. Very clever!
@actor199274 жыл бұрын
Drago mi te vidjeti Saldina nakon dugo godina, sretno s radom 😊
@CodeBeauty4 жыл бұрын
Ne znam ko je, ali hvala ti puno! :D
@wasimkhan-th1it4 жыл бұрын
I m student of bscs.your video really helps me. Thank you
@CodeBeauty4 жыл бұрын
That is awesome! Happy to help 🤗
@soldiers4christ495 Жыл бұрын
Your videos are really helpful i'm only in eighth grade and i am understanding the concepts that even the bigger grades don't understand. Keep doing what your doing.
@soldiers4christ495 Жыл бұрын
LIKE AND SUB EVERY ONE!!!!!!!!!!!!!!!!!!!!!!!!!
@yashjadhav68383 жыл бұрын
thank u so much now ik how to find last digit using number % 10 and remove last digit by using number / 10 this methods will come handy in future
@yashsonawane9053 жыл бұрын
Best use of / and % operator. Hats off :)
@CodeBeauty3 жыл бұрын
🙏💙
@omaristaitia56283 жыл бұрын
you are the best Saldina , very nice
@sasajuricevic13304 жыл бұрын
Hello CodeBeauty, this is very helpfull video for understanding modulo and while loop....Will be also interesting to se how to manipulate char or double type of variables on this example. Will be very helpfull to everybody to understand that for diferent type of var there must be also different aproach :)... BTW You are great !!! idemo dalje :)
@yummy95542 жыл бұрын
This harder than previous lesson, am think that because I lack understanding it feel more like about know the formula and am bad at math so I did not think of way to comeup with how to do it myself, am just sharing but this lesson is very good it is clear and am able understand how it happen just that am think that I won't comeup with a way to reverse engineer it if am asked to do without knowing formula because am bad at math 😆 int num; int counter = 0; cin >> num; while (num != 0) { counter = counter * 10; counter = counter + num % 10; num = num / 10; } cout
@jerseychou4323 Жыл бұрын
Thank you CodeBeauty!
@patrickmafabi58323 жыл бұрын
Hi Saldina! thank you for your great work. i would like to know what the void means please
@aquibkaneki5714 жыл бұрын
please explain difference about int(main) and void(main)
@IrisFlorentinaA3 жыл бұрын
she explained in the first or the second video of this C++ for beginners playlist, check there IN THE COMMENT SECTION
@cuol56753 жыл бұрын
finally my calculation program came in handy now, lol
@acridpie4492 Жыл бұрын
If one is unable to solve problems in a snap, do you think that person can ever be a good programmer or lets say a somewhat programmer?
@CodeBeauty Жыл бұрын
Of course, it will take you a few years of practice to feel confident in your knowledge and even most experienced developers make mistakes and don't solve new problems in a snap 😃
@MarceloMoraes Жыл бұрын
A great video. If the last digit of a number is 0 (like 1230) it shows also 321 (it make sense , but...) how to show all digits including the last 0 like 0321 ???
@lolll75058 ай бұрын
int main() { bool firstDigitZero = {}; int number = {}, reversedNumber = 0; cout > number; while (number != 0) { reversedNumber *= 10; reversedNumber += number % 10; number /= 10; if (reversedNumber == 0) firstDigitZero = true; } (firstDigitZero) ? cout
@lolll75058 ай бұрын
For multiple 0 -> int main() { short firstDigitZeroCounter = {}; int number = {}, reversedNumber = {}; cout > number; while (number != 0) { reversedNumber *= 10; reversedNumber += number % 10; number /= 10; if (reversedNumber == 0) firstDigitZeroCounter++; } cout
@mhdjaseem31953 жыл бұрын
thanks, mam💕💖
@CodeBeauty3 жыл бұрын
😘😘
@ayeshaamjad25134 жыл бұрын
best explained.
@CodeBeauty4 жыл бұрын
😊🤗
@branriv84173 жыл бұрын
If I’m not mistaken when going through the final iteration we are assigning 1/10 to number and (1/10)%10 to reversedNumber so the program must know to round (1/10)%10 up to 1? Is it safe to assume that in C++ any number > 0 but < 1 % 10 will be rounded up to 1?
@perezgalvanalexiaberenice31944 жыл бұрын
Great videos with very good explanations! I´m starting to learn to code and it has been very helpful but I have a doubt with the difference between int main ( ) and void main ( ), how does each main ( ) affect the code?
@IrisFlorentinaA3 жыл бұрын
she explained in the first or the second video of this C++ for beginners playlist, check there IN THE COMMENT SECTION
@perezgalvanalexiaberenice31943 жыл бұрын
@@IrisFlorentinaA Thanks!
@mpteevee2 жыл бұрын
how would u reverse 10 digits? ( user inputs 10 numbers and it outputs those reversed )
@memesgrenade79153 жыл бұрын
actually i didn't understanded what does this (%) mean can you please explain with a reply?
@branriv84173 жыл бұрын
You have to watch her previous videos but % (modulo) operator returns the remainder of two operands. For example 5%2 would be 1 because if you take 5/2 there would be a remainder of 1. % only works with integers (not with decimal or floating point numbers)
@kelvinwilliams29084 жыл бұрын
In the Tutorial 13 algorithm, the third step was to take the last digit from the entered number and to do this you used the Modulo operation.However, in Tutorial 12 there was a similar algorithm and again we had to remove the last digit of a number. In this case you divided the number by 10 and lost the decimal place. My understanding of the Modulus operation (from Tutorial 6 on Operators) was that it gives the remainder of a division so that 5%2 = 1. So why in Tutorial 13 did you use the Modulo operation rather than dividing by 10 as in Tutorial 12?
@CodeBeauty4 жыл бұрын
As you said yourself, % operator gives you the remainder after you divide two whole numbers. One very convenient thing is that each time that you modulate your int number by 10, you are going to get the last digit of that number. For example: 123/10=12 (that 3 is just thrown away) 123%10=3 (with % operator, we get that 3 remainder) In the Tutorial 12, we are just counting digits of a number, which means that for each digit in our number we just need to increase the counter of digits, and then we can throw that digit away. That is why in Tutorial 12, I just do: number/=10; (throw one digit away) counter++;( increase the counter of digits) In Tutorial 13, we are reversing the number. That means that we have to: lastDigit=number%10; (take the last digit of users number, and store it somewhere, not just throw it away) reversedNumber+=lastDigit; (add that digit to our reversed number) number/=10; (throw one digit away for users number, so that in the next iteration we don't get the same number that we had in the previous iteration, but a number that has one digit less) So the key difference is that, when you use / operator in an expression like number=number/10, you are going to remove one digit from your number and store the result back in your number variable . But when you use % operator in an expression like lastDigit=number%10, you are just going to get the last digit of your number and store it in the lastDigit variable . And depending on whether you need to take the last digit of the number and do something with it, or you just need to get rid of it, you're going to use one or the other. Understood? 😊
@traianbadea73894 жыл бұрын
@@CodeBeauty It is very important that you explained here. I had the same problem's understanding like Kelvin, but here you explain very well the difference between these. Thank you All the best
@puneetjadaun49433 жыл бұрын
I tried to run the program but I am getting an error saying Time Limit Exceeded. What to do ???
@harshalshelekar60103 жыл бұрын
and what we gonna do about '0' .... it doesn't show .... and also i got this error i am beginner so will you explain me ReverseNumber.cpp:4:1: error: '::main' must return 'int' 4 | void main()
@JarekAtWork Жыл бұрын
One variable: int main() { cout number; if (number < 0) { number *= -1; cout 0) { cout
@rokomedancic349 Жыл бұрын
Sta se desava ako deklariramo varijablu unutar petlje? Varijabla se svaki put deklarira? Sta ne trosi to svaki put drugu lokaciju u memoriji? Sta nije bolje da se jedanput deklarira van petlje, pa da se unutar petlje mjenja samo vrijednost? Taj nacin na koji si ti napravila sam vidio vise puta, ali ga ne razumjem. Inace odlican algoritam i odlican primjer! :)
@stevend13944 жыл бұрын
This maam is cute, so I'll subscribe it haha
@sarazamani27939 ай бұрын
Love it
@robertkalny41523 жыл бұрын
May be another solution how we can get last digit of number. Is there something wrong from point of programators view? while (number != 0) { reversedNumber *= 10; reversedNumber = reversedNumber + (number - (number / 10 * 10)); number = number / 10; } by the way, your tutorials are amazing, I program for a long time as a self-taught person but I miss these basics. Beautifully understandable
@sarazamani27939 ай бұрын
Awesome
@sanadshafie14843 жыл бұрын
OR while (number!=0) { cout
@ahmadosama26522 жыл бұрын
Also we can do it like this rev = rev * 10 + n%10;
@Павелик-з4е4 жыл бұрын
My girl.
@teekay4282 Жыл бұрын
For beginners and I’m seeing void main and system pause🙄