~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;
}
Retrieved from http://wiki.zeropage.org/wiki.php/XOR삼각형/곽세환
last modified 2021-02-07 05:28:27