Tuesday, July 28, 2009

Can any one tell me how to print the prime number upto 100 using C?

print the prime numbers upto 100


using c

Can any one tell me how to print the prime number upto 100 using C?
well use a loop to give u 100 numbers then they must be divided by 2,3,5,7....if any number is not divided by these prime factors then its a prime number...... if this helps kindly make it best answer :)
Reply:run a loop from 2 to 100, then check for prime as follows:


run a loop on the no. from half the no. till 2. If it is divisible anywhere its non - prime else prime. If u want the prog i can write it 4 u but i know only c++


No comments:

Post a Comment