Advertisement
ntamas

Untitled

Oct 14th, 2013
97
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C# 1.10 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.           if (tomb[j] % 10 == 0)
  34.           {
  35.             Console.Write("{0}: {1}", d * tomb[j], j+1);
  36.             if(j + 1 != elemszam)
  37.             {
  38.               Console.Write(", ");
  39.             }
  40.             else
  41.             {
  42.               Console.WriteLine();
  43.             }
  44.           }
  45.         }
  46.         d += 2;
  47.       }
  48.       int hossz;
  49.       hossz = tomb.Length;
  50.       Console.WriteLine("A tömb hossza: {0}", hossz);
  51.       Console.ReadKey();
  52.     }
  53.   }
  54. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement