Loops – For, While, Do While (Exercise) – Learn C#

1  comments

This is an exercise for this YouTube video.

Happy learning and good luck!

Which loop should you use for a fixed amount of loop iterations?
Which loop runs the code inside the curly braces before checking the condition?

 

Assignment: Write code which will sum numbers from 0 to n (inclusively) where n is your made up number.

 

Click to see the answer

 

 

 

 

 

About the author 

Matt Rešetár

Matt is an app developer with a knack for teaching others. Working as a Flutter freelancer and most importantly developer educator, he doesn't have a lot of free time 😅 Yet he still manages to squeeze in tough workouts 💪

You may also like

Flutter Bloc & Cubit Tutorial

Flutter Custom & Staggered Page Transition Animation Tutorial

  • I don’t really get why we need a do while loop. Ok, it runs the code before checking the condition, so it runs at least once. I got that, just a bit weird for me, maybe because I’m coming from Python. Great tutorials btw. Keep up the good work.

  • {"email":"Email address invalid","url":"Website address invalid","required":"Required field missing"}
    >