Advertisement
Ochkasty_Dino

Practicum4-VII-16

Sep 23rd, 2019
150
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.92 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5. using System.Threading.Tasks;
  6.  
  7. namespace ConsoleApp1
  8. {
  9.     class Program
  10.     {
  11.         static void Main()
  12.         {
  13.             Console.WriteLine("Please, enter the a = ");
  14.             int a = int.Parse(Console.ReadLine());
  15.             Console.WriteLine("Please, enter the b = ");
  16.             int b = int.Parse(Console.ReadLine());
  17.             while (a < b)
  18.             {
  19.                 int c = 2*a + 1;
  20.                 int k = c;
  21.                 for (int i = a + 1; i > 1; i--)
  22.                 {
  23.                     if (c % i == 0)
  24.                     {
  25.                         c = c / i; break;
  26.                     }
  27.  
  28.                 }
  29.                 if (c != k)
  30.                 {
  31.                     Console.WriteLine("{0},{1};", a, (a + 1));
  32.                 }
  33.                 a++;
  34.             }
  35.         }
  36.     }
  37. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement