[ create a new paste ] login | about

Link: http://codepad.org/RHjClcsr    [ raw code | output | fork ]

C, pasted on Apr 26:
#include<stdio.h>
#include<conio.h>
int main()
{
	// Tích = 2 * Tổng
	/*for (int i = 10; i < 100; i++)
	{
		int a = i % 10;
		int b = i / 10;

		if (a * b == 2 * (a + b))
		{
			printf("%4d", i);
		}
	}*/


	// Cách 2
	for (int i = 1; i < 10; i++)
	{
		for (int j = 0; j < 10; j++)
		{
			if (i * j == 2 * (i + j))
			{
				printf("%d%d   ", i, j);
			}
		}
	}


	_getch();
	return 0;
}


Output:
1
2
3
4
Line 17: error: conio.h: No such file or directory
In function 'main':
Line 19: error: 'for' loop initial declaration used outside C99 mode
Line 21: error: 'for' loop initial declaration used outside C99 mode


Create a new paste based on this one


Comments: