#include<stdio.h> int main() { int n,a,b,i; int sum=0 ; scanf("%d%d",&a,&b); { for (n=a;n<=b;n++) { for (i=2;i<=n-1;i++) if (n%i==0) break; if (i>=n) sum+=n; } printf("%d",sum); printf(" "); } }
#include<stdio.h>
int main()
{
int n,a,b,i;
int sum=0 ;
scanf("%d%d",&a,&b);
{
for (n=a;n<=b;n++)
{
for (i=2;i<=n-1;i++)
if (n%i==0) break;
if (i>=n)
sum+=n;
}
printf("%d",sum);
printf("
");
}
}
#include<stdio.h> int main() { int n,a,b,i; int sum=0 ; while ( scanf("%d%d",&a,&b)==2) { for (n=a;n<=b;n++) { for (i=2;i<=n-1;i++) if (n%i==0) break; if (i>=n) sum+=n; } printf("%d",sum); printf(" "); } }
#include<stdio.h>
int main()
{
int n,a,b,i;
int sum=0 ;
while ( scanf("%d%d",&a,&b)==2)
{
for (n=a;n<=b;n++)
{
for (i=2;i<=n-1;i++)
if (n%i==0) break;
if (i>=n)
sum+=n;
}
printf("%d",sum);
printf("
");
}
}
****************************************************************************************************************************************
#include<stdio.h> int main() { int n,a,b,i; int j,s; int c[1000]; while ( scanf("%d%d",&a,&b)==2) { j=0; for (n=a;n<=b;n++) { for (i=2;i<=n-1;i++) if (n%i==0) break; if (i>=n) c[j++]=n; } s=0; for (i=0;i<j;i++) s=s+c[i]; printf("%d ",s); } return 0; }
#include<stdio.h>
int main()
{
int n,a,b,i;
int j,s;
int c[1000];
while ( scanf("%d%d",&a,&b)==2)
{
j=0;
for (n=a;n<=b;n++)
{
for (i=2;i<=n-1;i++)
if (n%i==0) break;
if (i>=n)
c[j++]=n;
}
s=0;
for (i=0;i<j;i++)
s=s+c[i];
printf("%d
",s);
}
return 0;
}