Keywords: prime c program, c program for prime numbers, c program to find prime numbers, a program for the prime number in c, c program for a prime number. In this example, you will learn how to check whether the input number is a Prime number or not. See the below example:

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 | #include<stdio.h> int main() { int num, i, count = 0; printf("Enter a number:"); scanf("%d", &num); for (i = 2; i <= num / 2; i++) { if (num % i == 0) { count++; break; } } if (count == 0) printf("%d is a prime number", num); else printf("%d is not a prime number", num); return 0; } |

- C program to solve the Number of stopping station problem
- C implementation of inserting a new node to a link list
- C program to find the sum of all nodes in a tree
- C program to count number of non leaf nodes of a given tree
- C program to find the common ancestor and print the path
- C program to traverse the tree recursively
- C program to search for an element in the linked list without using recursion
- C Program to Implement Naor-Reingold Pseudo Random Function
- C Program to Implement the Bin Packing Algorithm
- How to Sort Linked List to Balanced BST

Article Tags: c program for prime number, c program for prime numbers, c program to find prime numbers, c tutorials, prime number program in c, write a program to find prime numbers from 1 100

We use cookies to ensure that we give you the best experience on our website. If you continue to use this site we will assume that you are happy with it.Ok