Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- int szamlalo = 0;
- int[] konyvek = new int[10] { 7, 10, 1, 3, 2, 8, 4, 9, 6, 5};
- for (int a = 0; a < konyvek.Length-1; ++a)
- {
- for (int b = a+1; b < konyvek.Length; ++b)
- {
- if (konyvek[b] < konyvek[a])
- {
- szamlalo++;
- int c = konyvek[a];
- konyvek[a] = konyvek[b];
- konyvek[b] = c;
- for (int i = 0; i < 10; i++)
- {
- Console.Write(" {0}",konyvek[i]);
- }
- Console.WriteLine();
- }
- }
- }
- Console.WriteLine(szamlalo);
- Console.ReadKey();
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement