Welcome to the new platform of Programmers Heaven! We apologize for the inconvenience caused, if you visited us from a broken link of the previous version. The main reason to move to a new platform is to provide more effective and collaborative experience to you all. Please feel free to experience the new platform and use it's exciting features. Contact us for any issue that you need to get clarified. We are more than happy to help you.
How to check a number's prime or not by C
[color=Blue][size=2]dear friends, I need help in C programming, how to check a number is prime or not. the following instructions:
Checking Prime Numbers
Prime number is an integer more than 1 that can not be divided into more integers by integers other than by himself. Examples of prime numbers: 2, 3, 5, 7, 11, 13, 17, etc.. For example, 9 is not prime because 9 can be divided by 3. Is -5 primes? According to the above definition, a prime number is a positive integer, so -5 is not prime.
Write out a program that reads N numbers (-32 000 <N <32,000). For each number, determine whether the number is prime or not.
Use the function eof (names and how to use different functions for Pascal and C) to check whether the input has reached the end of file.
Many lines, from 1 to 100 lines, each containing an integer N.
For each row, print YES if N is prime, or NO if not.