Problem Link
Solution :
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include <stdio.h> | |
#include<math.h> | |
int main() | |
{ | |
int i,num,count=0,j,n,root=0; | |
while(scanf ("%d",&num)==1){ | |
for(j=1;j<=num;j++){ | |
scanf("%d",&n); | |
if(n==0 || n==1) | |
printf("Not Prime\n"); | |
else{ | |
count=1; | |
root=sqrt(n); | |
for(i=2;i<=root;i++){ | |
if(n%i==0){ | |
count=0; | |
break; | |
} | |
} | |
if(count==1) | |
printf("Prime\n"); | |
else | |
printf("Not Prime\n"); | |
} | |
} | |
} | |
return 0; | |
} | |
Problem : 1170
Problem Link
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
int n,i,ck; | |
double kg; | |
while(scanf("%d",&n)==1){ | |
for(i=1;i<=n;i++){ | |
scanf("%lf",&kg); | |
ck=0; | |
while(kg>1){ | |
kg=kg/2; | |
ck++; | |
} | |
printf("%d dias\n",ck); | |
} | |
} | |
return 0; | |
} |