Untitled

 avatar
unknown
plain_text
3 years ago
435 B
6
Indexable
#include<stdio.h>
#include<stdbool.h>
#include<math.h>
#define nhap(n) scanf("%d",&n);
#define xuat(a,b) printf("%d %d ",a,b);
bool check(int n)
{
	int i;
	for(i=2;i<=sqrt(n);i++) if(n%i==0) return 0;
	return n>1;
}
void lietke(int n)
{
	int i;
	if(n==4) puts("2 2");
	else
	for(i=3;i<=n/2;i+=2 ) if(check(i)==1&&check(n-i)==1) xuat(i,n-i);
	puts("");
}
main()
{
	int test,n;
	nhap(test);
	while(test--)
	{
		nhap(n);
		lietke(n);
	}
}
Editor is loading...