WRITE A C PROGRAM TO ACCEPT A NUMBER AND FINDOUT WHETHER IT IS PRIME OR NOT.
Answers
Answered by
2
Answer:
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 <stdlib.h>
int num, j, flag;
printf("Enter a number \n");
scanf("%d", &num);
if (num <= 1)
printf("%d is not a prime numbers \n", num);..
Explanation:
Proof: The definition of a prime number is a positive integer that has exactly two positive divisors. However, 1 only has one positive divisor (1 itself), so it is not prime. ... A prime number is a positive integer whose positive divisors are exactly 1 and itself.
Similar questions