Skip to content

checking of prime number #300

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 3 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
.vscode/
2 changes: 1 addition & 1 deletion Pointers.c
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
* object.
* A pointer in C is used to allocate memory dynamically i.e. at run time.
*/

// int*ptr means it stores the address of another variable which is of type integer
#include <stdio.h>

int main(void) {
Expand Down
20 changes: 20 additions & 0 deletions modifiedprime.c
Original file line number Diff line number Diff line change
@@ -0,0 +1,20 @@
#include<stdio.h>
int main(){
int n,count=0;
printf("enter a number:\n");
scanf("%d",&n);
int i=1;
while(i<=n){
if(n%i == 0){
count++;
}
i++;
}
if(count == 2){
printf("The number %d is a prime number\n",n);
}
else{
printf("\nThe number %d is not a prime number\n",n);
}
return 0;
}