Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- using System;
- using System.Collections.Generic;
- using System.Linq;
- using System.Text;
- using System.Threading.Tasks;
- namespace Minimalna_liczba
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.WriteLine("Podaj A");
- int A = Convert.ToInt32(Console.ReadLine());
- Console.WriteLine("Podaj K");
- int K = Convert.ToInt32(Console.ReadLine());
- int[] liczby = new int[A];
- Console.WriteLine("Podaj " + A + " liczb");
- for(int i=0;i<A;i++)
- {
- liczby[i] = Convert.ToInt32(Console.ReadLine());
- }
- Array.Sort(liczby);
- int j = liczby[0]+1;
- for(; ;)
- {
- if(j%K==0&&j<liczby[liczby.Length-1])
- {
- if(!liczby.Contains(j))
- {
- Console.WriteLine("Znaleziono:"+j);
- break;
- }
- }
- else if(j == liczby[liczby.Length - 1])
- {
- Console.WriteLine("Nie znaleziono");
- break;
- }
- j++;
- }
- Console.Read();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement