Advertisement
ntamas

20131014 SZF: 4. program

Oct 14th, 2013
130
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.94 KB | None | 0 0
  1. using System;
  2. using System.Collections.Generic;
  3. using System.Linq;
  4. using System.Text;
  5.  
  6. namespace primek
  7. {
  8.   class Program
  9.   {
  10.     static void Main(string[] args)
  11.     {
  12.       string a;
  13.       int b, i=1, c=0;
  14.       int d=1;
  15.       int elemszam = 10;
  16.       int[] tomb = new int[elemszam];
  17.       Console.Write("Szám: ");
  18.       a = Console.ReadLine();
  19.       b = Convert.ToInt32(a);
  20.       do
  21.       {
  22.         if(i % b == 0)
  23.         {
  24.           tomb[c] = i;
  25.           c++;
  26.         }
  27.         i++;
  28.       }while(c < elemszam);
  29.       for (int k = 0; k < 2; k++)
  30.       {
  31.         for (int j = 0; j < elemszam; j++)
  32.         {
  33.           Console.Write(d * tomb[j]);
  34.           if (j + 1 != elemszam)
  35.           {
  36.             Console.Write(", ");
  37.           }
  38.           else
  39.           {
  40.             Console.WriteLine();
  41.           }
  42.         }
  43.         d += 2;
  44.       }
  45.       Console.WriteLine(tomb.Length);
  46.       Console.ReadKey();
  47.     }
  48.   }
  49. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement