Question Using for Loop

Devil

New member
Joined
Dec 8, 2021
Messages
1
Programming Experience
Beginner
Hello Friends,
I am new here and want to learn C#.
Can anyone solve this Que.
1
12
123
1234 upto 12345678910.
Thank You!!
 
It looks like a loop from 1 to 10 lines, and on each line a loop from 1 to current line number.
 
Yes. It is very likely the point of this exercise is for the student to learn about nested for loops, but as the inventor of Perl says, one of attributes of a good programmer is laziness. So to that statement, this is also do-able with just a single for loop.
 
It can even be done without an explicit loop using ForEach extension :) Just a single line of code, imagine!
 
The question is, can you solve it, given that it's your homework? We can help you but getting other people to do your homework for you is cheating, which is not appreciated here. Make your best attempt and tell us where you're stuck if you need help. Remember that you are allowed to think about the problem. You don't have to just pluck code out of thin air. Think about the logic first, which has nothing specifically to do with programming, and then try to come up with code to implement that logic.
 
My favorite programming prompt is: "Imagine you a task to do, but you can only it by talking to a 5 year old and have them do the task for you. How would you tell that 5 year old to do things?"
 
Back
Top Bottom