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?
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"); }
oh and i forgot to say its a algorithm called Sieve of Eratosthenes
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.
Have you searched the board? This gets posted at least once a week.
Quzah.
Hope is the first step on the road to disappointment.
*smiiiiiiile* Thanks...