Advertisement
VEGASo

(C#) Lab #3 Ex. 6* (Дополнительные (общие) задание)

Oct 15th, 2022
721
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.78 KB | None | 0 0
  1. using System;
  2.  
  3. namespace LearnRSUE
  4. {
  5.     class Program
  6.     {
  7.         static void Main()
  8.         {
  9.             int one, two;
  10.  
  11.             Console.Write("От какого числа(диапазон): ");
  12.             one = Convert.ToInt32(Console.ReadLine());
  13.  
  14.             Console.Write("До какого числа(диапазон): ");
  15.             two = Convert.ToInt32(Console.ReadLine());
  16.  
  17.  
  18.             for (int i = one; i <= two; i++)
  19.             {
  20.                 if (i % 2 != 0 && i % 3 != 0 && i != 1 && i % 5 != 0)
  21.                 {
  22.                     Console.WriteLine(i);
  23.                 }
  24.                 else if (i == 2 || i == 3 || i == 5)
  25.                 {
  26.                     Console.WriteLine(i);
  27.                 }
  28.             }
  29.         }
  30.     }
  31. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement