A simple program asks the user to give a number and then the program will check if the given number is a prime number or not using a c programming language.

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.
Please subscribe to my channel  https://www.youtube.com/channel/UCOs-lpOoIeJoh6gpJthPoGg

Program Listing

#include <stdio.h>

int main()
{
    int a=0,i=0,flag=0;
    
    printf("\n\n");
    printf("\tGive a number: ");
    scanf("%d",&a);
    
	printf("\n");
    flag=0;
    for(i=2;i <= a/2;i++)
    {
        if(a%i == 0)
        {
            flag=1;
            break;
         }
    }
    if(flag==0)
        printf("\tThe given number %d is a Prime Number.",a);
    else
          printf("\tThe given number %d is Not a Prime Number.",a);
    printf("\n\n");
    printf("\tEnd of Program");
    printf("\n");
    return 0;
}

Leave a Reply

Your email address will not be published. Required fields are marked *