U E D R , A S I H C RSS

XOR삼각형/곽세환

~cpp 
#include <iostream>
using namespace std;

int main()
{
	int ar[10][10]={{0}};
	for (int k = 0; k < 10 - 1; k++)
		cout << " ";
	ar[0][0] = 1;
	cout << ar[0][0] << endl;
	for (int i = 1; i < 10; i++)
	{
		for (int k = 0; k < 10 - 1 - i; k++)
			cout << " ";
		for (int j = 0; j < i + 1; j++)
		{
			if (j == 0)
				ar[i][j] = 1;
			else
				ar[i][j] = (ar[i-1][j] == ar[i-1][j-1]) ? 0 : 1;
			cout << ar[i][j] << " ";
		}
		cout << "\n";
	}
	
	return 0;
}
Valid XHTML 1.0! Valid CSS! powered by MoniWiki
last modified 2021-02-07 05:28:27
Processing time 0.0051 sec