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 ConsoleApplication3
- {
- class Program
- {
- static void Main(string[] args)
- {
- Console.Write("Hány számot olvassunk be:");
- int n = int.Parse(Console.ReadLine());
- int[] x = new int[n];
- int[] y = new int[n];
- int i = 0;
- int j = 0;
- int paros = 0;
- for (i = 0;i < n; i++)
- {
- Console.Write("Adj meg egy számot: ");
- x[i] = int.Parse(Console.ReadLine());
- }
- for (i = 0; i < n; i++)
- {
- if (x[i] % 2 == 0)
- {
- paros = x[i];
- for (j = 0; j < n; j++)
- {
- y[j] = paros;
- paros = 0;
- }
- }
- }
- Console.WriteLine("Ezek a páros számok:");
- for (j = 0; j < n; j++)
- {
- Console.WriteLine(y[j]);
- }
- Console.ReadKey();
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement