Resolved Question About For Loop

Ersoylu

New member
Joined
Sep 7, 2021
Messages
1
Programming Experience
Beginner
Hello everyone, i have a question about how can i create an for loop with user input.
Basicly what i need to do is take 2 numbers from the user and show the numbers between as an result.

Console.WriteLine("Write down 2 numbers");
int input = Convert.ToInt32(Console.ReadLine());
int input2 = Convert.ToInt32(Console.ReadLine());


for (int i = 0; i < input; i++) { }

I am stuck on how can i calculate between nummers that user inputs.
Thanks for help
(I started programing like 2 days ago so I am very new to this, sorry if i created this post in a wrong section.)
 
Why not let i start at value input and end at the value input2? You are not constrainted to starting for loops with an initial value of 0.

As a quick aside, while you are still early in your programming journey, take time to learn how to use meaningful identifiers. For example, instead of using input and input2, I would suggest using start and end.
 

Latest posts

Back
Top Bottom