SIEVE - if(arr[a!=0 if(arr[b%arr[a]==0 arr[b]=0;b...

Info iconThis preview shows page 1. Sign up to view the full content.

View Full Document Right Arrow Icon
#include<stdio.h> #include<conio.h> # void main (void) { int arr[1000]; int a,b; clrscr(); for(a=0;a<1000;a++) arr[a]=a+1; for(a=1;a<1000;a++) {b=a+1; while(b<1000)
Background image of page 1
This is the end of the preview. Sign up to access the rest of the document.

Unformatted text preview: { if(arr[a]!=0) if(arr[b]%arr[a]==0) arr[b]=0;b++;} } for(a=0;a<1000;a++) if(arr[a]!=0) printf("%d\t",arr[a]); getch(); }...
View Full Document

Ask a homework question - tutors are online