adspace
Answer Posted / Anjani Kumar Sinha
To write a C++ program to find the first ten prime numbers, you can use the following code:```cppn#include <iostream>nusing namespace std;nvoid printPrimes(int n) {n bool isPrime[n + 1]; // boolean array to store if a number is primenfill(isPrime, isPrime + n + 1, true); // init all numbers as primenfor (int p = 2; p * p <= n; ++p) {n for (int i = p * p; i <= n; i += p) {n isPrime[i] = false;n }n}nfor (int p = 2, count = 0; p <= n; ++p) {n if (isPrime[p]) {n cout << p << " ";n ++count;n if (count == 10) return;n }n}n}
| Is This Answer Correct ? | 0 Yes | 0 No |
Post New Answer View All Answers
i need recent placement paper
sir i need a few nots of electronics component cicuit plz send me some nots
Dear All,I have RRB exam on 19th dec Plz send me the Last 5 years RRB Q&A of Electronics & communication Dept to mail id sham28sharieff@gmail.com.. please frnds if u do have the Q&A.. Plz send it..
send me jto(telecom) exam papers
Hi i am chinna reddy i had completed my b.tech(ECE)2010 passout. but still no job please if anyone help me and suggest me. my mailid:chinnareddy.be@gmail.com Thanks&Regards chinna
Please, give me the simple circuit dig. for "oscillator with variable frequency & upto 6W". I will be very thankful to you.
Draw the equivalent circuit of triac and diac.
please send me last year question for executive tranees in ntpc on my email ID rajthakur2091@gmail.com
I am a fresher and i have done testing course from orbit institute hyd.can any1 say me whether it is necessary to do project in testing.if it is that which is best institute in hyd.can you please inform me if there is any job 4 freshers.thanxs
i want the aptitude test papers of wipro can any one help plz
Please give the model or previous year question paper for the lecture post in government Engineering College (Electronics and Communication)
sir plz send me BPCL recruitment(Engineering Trainee Electronics & Communication) sample question papers & Topics as early as possible
hello sir, could u plz send me a sample placement paper for hpcl trainee engg exam..(electronics stream)...hoping to hear from u at the earliest. Thanking you.
i want to know the syllabus for management trainee exam,vizag steel plant,2009
Any idea of BSNL, JTO paper?