Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
406 B
2
Indexable
Never
#include<stdio.h>
#include<math.h>
int nt(int n){
	for (int i=2;i<=sqrt(n);i++){
		if (n%i==0){
			return 0;
		}
		
	}
	return n>1;
}
int main(){
	int n,a[100];
	int dem;
	scanf("%d",&n);
	for (int i=1;i<=n;i++){
		scanf("%d",&a[i]);
	}
	for (int i=1;i<=n;i++){
		if (nt(a[i])!=0){
			dem++;
		}
	}
	printf("%d ",dem);
	for (int i=1;i<=n;i++){
		if (nt(a[i])!=0){
			printf("%d ",a[i]);
		}
	}
	return 0;
}