Original Post
I am a very early programmer, just working with basics programming right now. I have to make a program that takes the numbers 1 through 100 and finds all the prime numbers then prints out the average on screen. The following is what I had thought to try originally but though it prints to the screen all the primes from 11 through 97 correctly, it does not print 2,3,5,7. Reason for that is all those numbers mod themselves equal 0 thus they wont print. Also end result I will of course need to print the average rather than the actual primes but I am having it print the primes right now just so that I know they are all being processed correctly. Any hints on what else I should try? I am not looking for someone to do this for me, I won't learn by others doing the work. But if a hint could be dropped that would be helpful. Thanks :) { int primeNumber = 2; while (primeNumber <= 100) { if(primeNumber % 2 != 0 && primeNumber % 3 != 0 && primeNumber % 5 != 0 && primeNumber % 7 != 0) Console.WriteLine(primeNumber); primeNumber = primeNumber + 1; } }