Untitled

mail@pastecode.io avatar
unknown
plain_text
5 months ago
903 B
4
Indexable

#include <iostream>
using namespace std;
int main()
{
	int rozmiar = 5;

	int parz[25];
	int nieparz[25];

	int parzilosc = 0;
	int nieparzilosc = 0;

	int tab[5][5] = {
		
			{23,13,567,95,345},
	        {56,67,12,64,97},
		    {54,97,34,07,23},
		    {85,43,83,12,2},
		    {76,92,3,8,4}

	};

	for (int i = 0; i < 5; i++)
	{
		for (int j = 0; j < 5;j++)
		{
			if (tab[i][j] % 2==1)
			{
				parz[parzilosc++] = tab[i][j];
			}
		}
	}
	for (int i = 0; i < 5; i++)
	{
		for (int j = 0; j < 5; j++)
		{
			if (tab[i][j] % 2==0)
			{
				nieparz[nieparzilosc++] = tab[i][j];
			}
		}
	}


	cout << "\n";

	cout << "liczby nieparzyste:";

	for (int i = 0; i < parzilosc; i++)
	{
		cout  << parz[i]<<" ";
	}

	cout << "\n";

	cout << "liczby parzyste:";

	for (int i = 0; i < nieparzilosc; i++)
	{
		cout  << nieparz[i]<<" ";
	}


}


Leave a Comment