Created
May 28, 2020 12:47
-
-
Save wasit-shafi/b4a36d9d19ed8dd5f091acb906150020 to your computer and use it in GitHub Desktop.
Prime Number Program
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#include<stdio.h> | |
int main() | |
{ | |
int n, i = 2 ; | |
printf("Enter Value of n... "); | |
scanf("%d", &n); | |
if(n > 1) | |
while(n % i != 0) | |
i++; | |
if(i == n) | |
printf("%d is a Prime Number.", n); | |
else | |
printf("%d is not a Prime Number.", n); | |
return 0; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment