Create BilanganAgakPrima.c

master
Muhammad Daffa 2020-04-10 13:24:11 +07:00 committed by GitHub
parent c54e63ebc6
commit c71864d03f
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 32 additions and 0 deletions

View File

@ -0,0 +1,32 @@
#include <stdio.h>
#include <math.h>
long long int a,c,i,j,cek,tes,bts;
int main(void) {
scanf("%ld",&a);
for(i=1;i<=a;i++) {
scanf("%d",&c);
cek = 0;
tes = 3;
bts = trunc(c/2);
if (c%2 == 0 && c!= 2 || c == 1) {
cek++;
}
while(tes <= bts) {
if (c % tes ==0) {
cek++;
if(cek > 2) {
break;
}
}
tes++;
}
if (cek > 2) {
printf("BUKAN\n");
}
else {
printf("YA\n");
}
}
}