Showing posts with label checking prime number in C. Show all posts
Showing posts with label checking prime number in C. Show all posts

Wednesday, October 9, 2019

Check Prime Number in C

A simple in C programming to ask the user to give a number and then it will check if the given number is a prime number or not.

I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me in the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.

My telephone number at home here in Bacolod City, Negros Occidental Philippines is  +63 (034) 4335675.

Here in Bacolod I also accepting computer repair, networking and Arduino Project development at a very affordable price.

My personal website is http://www.jakerpomperada.com.


Program Listing

prime.c

#include <stdio.h>

main( )
{
int   num, i ;

printf ( "Enter a number " ) ;
scanf ( "%d", &num ) ;

i = 2 ;
while ( i <= num - 1 )
{
if ( num % i == 0 )
{
printf ( "Not a prime number" ) ;
break ;
}
i++ ;
}

if ( i == num )
printf ( "Prime number" ) ;

}