Pagini recente » Cod sursa (job #557183) | Cod sursa (job #2531860) | Cod sursa (job #678605) | Cod sursa (job #749915) | Cod sursa (job #230078)
Cod sursa(job #230078)
#include<stdio.h>
int n,x,y=4;
int main()
{
int i=2,suma=0;
bool ok=true;
freopen("nrtri.in","r",stdin);
freopen("nrtri.out","w",stdout);
scanf("%d%d",&n,&x);
while(y<=2*x)
{
for(i=2;i<=y/2 && ok!=false;++i)
{
if(y%x==0 && y%i!=0)
ok=true;
else ok=false;
}
if(y==2*x)
{
printf("%d\n",suma);
scanf("%d",&x);
suma=0;
}
if(ok==true)
suma=suma+y;
++y;
ok=true;
}
return 0;
}