Horje
Prime Number Check Program in C Code Example
Prime Number Check Program in C
#include <stdio.h> 

main() {
  int n, i, c = 0;
  printf("Enter any number n:");
  scanf("%d", &n);

  //logic
  for (i = 1; i <= n; i++) {
      if (n % i == 0) {
         c++;
      }
  }

  if (c == 2) {
  printf("n is a Prime number");
  }
  else {
  printf("n is not a Prime number");
  }
  return 0;    
}
Program Output:




C

Related
divide and conquer program in c Code Example divide and conquer program in c Code Example
Graphics in C Code Example Graphics in C Code Example
remove \n from string c Code Example remove \n from string c Code Example
array sortieren c Code Example array sortieren c Code Example
get time to complete code c Code Example get time to complete code c Code Example

Type:
Code Example
Category:
Coding
Sub Category:
Code Example
Uploaded by:
Admin
Views:
9