Вариант с использованием While namespace ConsoleApplication { class Program { static void Main(string[] args) { int a = Convert.ToInt32(Console.ReadLine()); int b = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(" "); while (a <= b) { if (a % 3 == 0) { Console.WriteLine(a); } a++; }
Console.ReadKey(); } } }
Вариант с использованием do while namespace ConsoleApplication { class Program { static void Main(string[] args) { int a = Convert.ToInt32(Console.ReadLine()); int b = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(" "); do { if (a % 3 == 0) { Console.WriteLine(a); } a++; } while (a <= b); Console.ReadKey(); } } }
Вариант с использованием for namespace ConsoleApplication { class Program { static void Main(string[] args) { int a = Convert.ToInt32(Console.ReadLine()); int b = Convert.ToInt32(Console.ReadLine()); Console.WriteLine(" "); for (int i = a; i <= b; i++) { if (i % 3 == 0) { Console.WriteLine(i); } } Console.ReadKey(); } } }
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota
Оформи подписку