Write a program in c to find prime number or not

2 years ago
C Programming

program in c to  find prime number or not.

#include<stdio.h>
#include<conio.h>

void main()
{
   int n, i, f;
   f = 0;
   printf("Enter a number");
   scanf("%d", &n);
   i = 2;
   
   while (i < n)
   {
      if (n % i == 0)
      {
         f = 1;
         break;
      }
      i++;
   }
   if (f == 1)
      printf("\n not a prime number");
   else
}
11
Rajiv Shah
Jul 22, 2022
More related questions

Questions Bank

View all Questions