0
Write a program for generating prime numbers in python
please write a simple code
5 Réponses
+ 8
#include<stdio.h>
int main(){
int n,i,m=0,flag=0;
printf("Enter the number to check prime:");
scanf("%d",&n); m=n/2;
for(i=2;i<=m;i++)
{ if(n%i==0)
{
printf("Number is not prime");
flag=1;
break;
}
}
if(flag==0)
printf("Number is prime");
return 0;
}
+ 5
Search the Code Playground for such codes, there are a lot in the bucket already :)
0
please write in python only
0
I recently made my 2.0 version of my previous code xD, it needs less operations, but it's less simple to understand I guess.
https://code.sololearn.com/c38NGLZvSBiP/?ref=app