Search found 4 matches

by Giggs
Tue Apr 29, 2003 6:47 am
Forum: Volume 102 (10200-10299)
Topic: 10200 - Prime Time
Replies: 202
Views: 96691

i can't get yours points. yours progremm and mine are both ok, i can run them on my computer.

int ifprime(int n) /*justify whether it is a prime*/
{int j;
for(j=2;j<n;j++)
{if (n%j!=0) continue;
else return (0);}
if(n==j)
return (1);
}

int creat_num(int n)
{int m;
m=n*n + n + 41;
return ...
by Giggs
Mon Apr 28, 2003 4:31 pm
Forum: Volume 102 (10200-10299)
Topic: 10200 - Prime Time
Replies: 202
Views: 96691

my code , it works

int ifprime(int n)
{int j;
for(j=2;j<n;j++)
{if (n%j!=0) continue;
else return (0);}
if(n==j)
return (1);
}

int creat_num(int n)
{int m;
m=n*n + n + 41;
return m;
}

main()
{int a,b,i;
float pre,sum;
int re=0;
clrscr();
scanf("%d %d",&a,&b);
for(i=a;i<=b;i++)
re=re+ifprime(creat_num(i));
sum=(float ...
by Giggs
Mon Apr 28, 2003 4:28 pm
Forum: Volume 102 (10200-10299)
Topic: 10200 - Prime Time
Replies: 202
Views: 96691

i don't konw how to submit that,so i paste it hehe
by Giggs
Mon Apr 28, 2003 4:26 pm
Forum: Volume 102 (10200-10299)
Topic: 10200 - Prime Time
Replies: 202
Views: 96691

this is my code

int ifprime(int n)
{int j;
for(j=2;j<n;j++)
{if (n%j!=0) continue;
else return (0);}
if(n==j)
return (1);
}

int creat_num(int n)
{int m;
m=n*n + n + 41;
return m;
}

main()
{int a,b,i;
float pre,sum;
int re=0;
clrscr();
scanf("%d %d",&a,&b);
for(i=a;i<=b;i++)
re=re+ifprime(creat_num(i));
sum=(float ...

Go to advanced search