Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdbool.h>
- int main(){
- bool flag=true;
- int n;
- printf("Enter the value of n : ");
- scanf("%d", &n);
- for (int i=2; i<n; i++) {
- if (n%i == 0){
- flag = false;
- break;
- }
- }
- if(flag==true){
- printf("\n%d is a Prime Number\n", n);
- }else{
- printf("\n%d is NOT a Prime Number\n", n);
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement