Pavle_nis

C# Parni-neparni brojevi

Oct 3rd, 2017
197
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.18 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 ConsoleApp3
  8. {
  9.     class Program
  10.     {
  11.         static void Main(string[] args)
  12.         {
  13.             int[] a = new int[10];
  14.             int[] b = new int[10];
  15.             int c, d, j = 0;
  16.             for (c = 0; c < 10; c++)
  17.             {
  18.                 d = Convert.ToInt32(Console.ReadLine());
  19.                 if (d == 0)
  20.                 {
  21.                     break;
  22.                 }
  23.                 else
  24.                 {
  25.                     if (d % 2 == 0)
  26.                     {
  27.                         a[c] = d;
  28.                     }
  29.                     else
  30.                         b[c] = d;
  31.                 }
  32.             }
  33.             Console.WriteLine("\n\n");
  34.  
  35.             for (c = 0; c < a.Length; c++)
  36.             {
  37.                 if (a[c] != 0)
  38.                     Console.WriteLine("{0},", a[c]);
  39.             }
  40.             Console.WriteLine("\n\n");
  41.             for (c = 0; c < b.Length; c++)
  42.             {
  43.                 if (b[c] != 0)
  44.                     Console.WriteLine("{0},", b[c]);
  45.             }
  46.         }
  47.     }
  48. }
Advertisement
Add Comment
Please, Sign In to add comment