CARVIEW |
Select Language
HTTP/2 302
server: nginx
date: Sun, 17 Aug 2025 21:44:09 GMT
content-type: text/plain; charset=utf-8
content-length: 0
x-archive-redirect-reason: found capture at 20080328164254
location: https://web.archive.org/web/20080328164254/https://www.daniweb.com/code/snippet808.html
server-timing: captures_list;dur=0.546366, exclusion.robots;dur=0.017921, exclusion.robots.policy;dur=0.008279, esindex;dur=0.009963, cdx.remote;dur=15.602769, LoadShardBlock;dur=336.960861, PetaboxLoader3.datanode;dur=119.442776
x-app-server: wwwb-app210
x-ts: 302
x-tr: 382
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
set-cookie: wb-p-SERVER=wwwb-app210; path=/
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
HTTP/2 200
server: nginx
date: Sun, 17 Aug 2025 21:44:10 GMT
content-type: text/html; charset=utf-8
x-archive-orig-date: Fri, 28 Mar 2008 16:42:54 GMT
x-archive-orig-server: Apache/2.2
x-archive-orig-x-powered-by: PHP/5.1.6
x-archive-orig-set-cookie: bblastactivity=0; expires=Sat, 28-Mar-2009 16:42:54 GMT; path=/; domain=.daniweb.com
x-archive-orig-cache-control: private
x-archive-orig-pragma: private
x-archive-orig-vary: Accept-Encoding,User-Agent
x-archive-orig-connection: close
x-archive-guessed-content-type: text/html
x-archive-guessed-charset: utf-8
memento-datetime: Fri, 28 Mar 2008 16:42:54 GMT
link: ; rel="original", ; rel="timemap"; type="application/link-format", ; rel="timegate", ; rel="first memento"; datetime="Fri, 28 Mar 2008 16:42:54 GMT", ; rel="memento"; datetime="Fri, 28 Mar 2008 16:42:54 GMT", ; rel="next memento"; datetime="Wed, 28 May 2008 18:47:55 GMT", ; rel="last memento"; datetime="Fri, 20 Feb 2009 02:26:40 GMT"
content-security-policy: default-src 'self' 'unsafe-eval' 'unsafe-inline' data: blob: archive.org web.archive.org web-static.archive.org wayback-api.archive.org athena.archive.org analytics.archive.org pragma.archivelab.org wwwb-events.archive.org
x-archive-src: 52_2_20080328145634_crawl100-c/52_2_20080328164248_crawl104.arc.gz
server-timing: captures_list;dur=0.571134, exclusion.robots;dur=0.021197, exclusion.robots.policy;dur=0.009632, esindex;dur=0.013288, cdx.remote;dur=9.725556, LoadShardBlock;dur=50.591527, PetaboxLoader3.datanode;dur=103.246892, load_resource;dur=210.070483, PetaboxLoader3.resolve;dur=74.501557
x-app-server: wwwb-app210
x-ts: 200
x-tr: 344
server-timing: TR;dur=0,Tw;dur=0,Tc;dur=0
x-location: All
x-rl: 0
x-na: 0
x-page-cache: MISS
server-timing: MISS
x-nid: DigitalOcean
referrer-policy: no-referrer-when-downgrade
permissions-policy: interest-cohort=()
content-encoding: gzip
Printing prime no in given range //Using efficient algorithm for large nos. - cplusplus
Printing prime no in given range //Using efficient algorithm for large nos.
•
•
•
•

What is DaniWeb IT Discussion Community?
You're currently browsing the C++ section within the Software Development category of DaniWeb, a massive community of 302,062 software developers, web developers, Internet marketers, and tech gurus who are all enthusiastic about making contacts, networking, and learning from each other. In fact, there are 3,854 IT professionals currently interacting right now! If you are in the IT industry or are just a technology enthusiast, you might find just what you're looking for in DaniWeb. Registration is free, only takes a minute and lets you enjoy all of the interactive features of the site.
Please support our C++ advertiser: Modernize Legacy Data with Sybase
Just playing with the no.
points used in the program:
1. Even no cannot be prime except 2
2. % division of odd by even cannot be 0
points used in the program:
1. Even no cannot be prime except 2
2. % division of odd by even cannot be 0
Last edited : Feb 8th, 2008.
# include<iostream.h> # include<math.h> void main() { int flag=0; unsigned long l, h, temp; cout<<"Enter the lower limit:"; cin>>l; cout<<"Enter the higher limit:"; cin>>h; if(l%2==0) { if(l==2) cout<<"2\t"; l++; //taking only odd no } for(;l<=h;l+=2, flag=0) { temp=sqrt(l); if(temp%2==0) temp++; //taking only odd no for(; temp>2; temp--) { if(l%temp==0) { flag=1; break; } } if(flag==0) cout<<l<<"\t"; } }
Comments (Newest First)
WXuan | Newbie Poster | 11 Days Ago

•
•
•
•
What's the difference between this threads and the last one???
Post Comment