Problem Description This program takes a number and checks whether a given number is prime or not. Problem Solution 1. Take a number as input. 2. Check if the number is divisible by any of the natural numbers starting from 2. 3. If it is, then it is not a prime number. Otherwise it is a prime number. 4. Exit. Program/Source Code Here is source code of the C program to check if a given number is prime. The C program is successfully compiled and run on a Linux system. The program output is also shown below. /* * C program to check whether a given number is prime or not * and output the given number with suitable message. */ #include #include void main() { int num, j, flag; printf("Enter a number \n"); scanf("%d", &num); if (num <= 1) { printf("%d is not a prime numbers \n", num); exit(1); } flag = 0; for (j = 2; j <= num / 2; j++) { if ((num % j) =
Success of Your life.These website will provides the latest technology and also provide the development of programming logic. computer science branch this website is very important. Every day practice code and developed the logic.