Category : primes

In my textbook, the algorithms and flowcharts for this problem use flag variables.So I gave it a try without using flag variables and got a solution (given below).But its implementation in C++ is quite puzzling. We haven’t officially learnt goto statements yet. So my doubt is whether its implementation in C++ is possible without using ..

Read more

My goal is that: the program return the list of numbers in the vector i made, which are the primes numbers, the code is wrong, #include <iostream> #include <vector> #include <math.h> using namespace std; vector < int > L; bool mark[10]; void colador() { fill(mark,mark+10, false); for(int i=2; i*i <=10; i++) { if(!mark[i]) { L.push_back(i); ..

Read more