Advertisement
ntamas

20131014 SZF: 3. program

Oct 14th, 2013
152
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 0.83 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 elemszam = 10;
  15.       int[] tomb = new int[elemszam];
  16.       Console.Write("Szám: ");
  17.       a = Console.ReadLine();
  18.       b = Convert.ToInt32(a);
  19.       do
  20.       {
  21.         if(i % b == 0)
  22.         {
  23.           tomb[c] = i;
  24.           c++;
  25.         }
  26.         i++;
  27.       }while(c < elemszam);
  28.       for(int j = 0; j < elemszam; j++)
  29.       {
  30.         Console.Write(tomb[j]);
  31.         if (j + 1 != elemszam)
  32.         {
  33.           Console.Write(", ");
  34.         }
  35.         else
  36.         {
  37.           Console.WriteLine();
  38.         }
  39.       }
  40.       Console.WriteLine(tomb.Length);
  41.       Console.ReadKey();
  42.     }
  43.   }
  44. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement