Answer the question
In order to leave comments, you need to log in
Given integers A and B (A < B). Output all integers from A to B inclusive; while the number A should be displayed 1 time, the number A + 1 2 times?
int a12, b12, n12;
Console.Write("Введите число A -> "); a12 = Convert.ToInt32(Console.ReadLine());
Console.Write("Введите число B -> "); b12 = Convert.ToInt32(Console.ReadLine());
if (a12 < b12)
{
for (; a12 <= b12; a12++)
{
Console.WriteLine(a12);
}
}
else
{
Console.WriteLine("Ошибка: A > B.");
}
Answer the question
In order to leave comments, you need to log in
2. The code is as terrible as possible because of the names of the variables, line breaks, and entering variables in advance.
3. Validation is not needed, because by the condition of the problem it is guaranteed that A < B
4. You do not have enough loop to repeat the number N times
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question