# Basic Array help

Show 80 post(s) from this thread on one page
Page 2 of 2 First 12
• 08-02-2002
quzah
I take it you've never had any introduction to algebra? N = some number thaty ou pick.

As for google not turning anything up, somehow I think you didn't even try...

Quzah.
• 08-02-2002
diddy02
No, still nothing. Of couse I tried. I don't understand what they say. They state there is no formula to compute Prime variables. So then how is it my teacher expects me to do this exercise?
• 08-02-2002
Unregistered
Code:

```#include <stdio.h> #define N 200 main()  {  int i, j, a[N];   for (i = 2; i < N; i++) a[i] = 1;   for (i = 2; i < N; i++) if (a[i])     for (j = i; i*j < N; j++) a[i*j] = 0;   for( i = 2; i < N; i++)     if (a[i]) printf("%4d ", i);     printf("\n");  }```
• 08-02-2002
Unregistered
oh and i forgot to say its a algorithm called Sieve of Eratosthenes
• 08-03-2002
diddy02
My tutor won't expect me to do that... I doubt it.

Okay... here's like my last attempt... it's 2:00 flipping AM and I know I won't get this done, but, let's hope. 1-200, prime.

Prime can only be divided by one and itself. All numbers can be diveded by one and itself.

Okay, so what it I just wrote down the prime numbers upto 10 and then did

//bear with the crap code, I can't type... or see for that matter right now. My mouse crapped out on me, my tutor's arriving in approx 8 hours and I haven't slept for awhile...

rmndr=cntr%2 //rmndr is the remeinder int... cntr is the counter.
if(rmndr==0) { // no remeinder means its not a prime number.
printf("n.a.p"); }//Printed Not a Prime.
rmndr=cntr%3 //rmnder is now = to counter / 3's remeinder.

// And the cycle continues till 9.
// If we have 10, it should print out n.a.p. If we have 11, it should
// break to something that will print it (printf("%d", cntr);
// So how do I use an array with this ...
// Why is god so crueL?
// And can anyone really just break everything down and give me
// simple exp? I give up. There... I can't take this anymore. I have
// like 5 more exercises to do and I can't let this one hold me back.
// P.S. Tylenol suxors. Motrin roxorz.
// P.P.S. Thanks to all for putting up with my idiocy... I know...
// but you see, I only see my tutor once a week and I easily forget
// what she says...so I need to keep on going over things on my
// own and I get confused a lot. T I A.
• 08-03-2002
quzah
Have you searched the board? This gets posted at least once a week.

Quzah.
• 08-03-2002
diddy02
*smiiiiiiile* Thanks...
Show 80 post(s) from this thread on one page
Page 2 of 2 First 12