Skip to content

Commit

Permalink
Merge pull request seeditsolution#399 from mack12/patch-1
Browse files Browse the repository at this point in the history
Create primenumber1
  • Loading branch information
seeditsolution authored Oct 2, 2020
2 parents 4e4552c + be200e8 commit 60d6746
Showing 1 changed file with 7 additions and 0 deletions.
7 changes: 7 additions & 0 deletions primenumber1
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
#include <stdio.h> int main()
{ int n, i, flag = 0; printf("Enter a positive integer: ");
scanf("%d", &n); for (i = 2; i <= n / 2; ++i) {
// condition for non-prime if (n % i == 0) { flag = 1; break; } }
if (n == 1) { printf("1 is neither prime nor composite."); }
else { if (flag == 0) printf("%d is a prime number.", n);
else printf("%d is not a prime number.", n); } return 0; }

0 comments on commit 60d6746

Please sign in to comment.