Username77177

Nure-Programming-ControlWork1Part2(OLD)

Oct 6th, 2019
114
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.42 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3.  
  4. namespace ControlWork1
  5. {
  6.     class Control1Part2
  7.     {
  8.         static void Main(string[] args)
  9.         {
  10.             int[] newintegerarray = new int[14];
  11.             int i = 0;
  12.  
  13.             while (i < 14)
  14.             {
  15.                 Console.WriteLine("Введите значение ("+ (i+1) + ") :");
  16.                 newintegerarray[i] = Convert.ToInt32(Console.ReadLine());
  17.                 i++;
  18.             }
  19.  
  20.             List<int> succesfulint = new List<int>();
  21.             List<int> succesfulintsorted = new List<int>();
  22.  
  23.             //Сложение
  24.             for (int k = 0; k < 14; k++){
  25.                 int fn = newintegerarray[k];
  26.                 for (int j = 0; j < 14; j++)
  27.                 {
  28.                     int sn = newintegerarray[j];
  29.                     int sum = fn + sn;
  30.                     if (sum % 3 == 0)
  31.                     {
  32.                         if (sum % 5 != 0)
  33.                         {
  34.                             succesfulint.Add(sum);
  35.                         }
  36.                     }
  37.                 }
  38.             }
  39.            
  40.             foreach (int item in succesfulint)
  41.             {
  42.                 if (succesfulint.Contains(item) == false)
  43.                 {
  44.                     succesfulintsorted.Add(item);
  45.                     Console.WriteLine(item);
  46.                 }
  47.             }
  48.         }
  49.     }
  50. }
Advertisement
Add Comment
Please, Sign In to add comment