is it possible to write the same program wit same commands without flag and also please describe flag
#include
int main(void){
int j,n,i,flag;
printf("Please enter a number : ");
scanf("%d",&n);
if(n<2) {
printf("\nNo prime numbers available");
return 1;}
printf("Thank you : 2");
for(i=2;i<=n;i++){
for(j=2;j<=i-1;j++){
if(i%j==0){
flag=0;
break;}
flag=1;
}
if(flag==1)
printf("%5d",i);
}
return 0;
}
2006-10-27
21:42:03
·
4 answers
·
asked by
Anonymous
in
Computers & Internet
➔ Programming & Design