first prime numbers
C++
#include<bits/stdc++.h>
using namespace std;
bool Is_Prime(long long x){
if(x%2==0)return false;
for(int i=3;i*i<=x;i+=2)
if(x%i==0)return false;
return true;
}
int main(){
//first n prime numbers
int n;
cin>>n;
int i=1;
while(n--){
while(!Is_Prime(++i));
cout<<i<<" ";
}
}
Also in C++:
- Title
- command line options in c++
- Category
- C++
- Title
- c++ string to int
- Category
- C++
- Title
- declare vectors c++
- Category
- C++
- Title
- what is difffrence between s.length() and s.size()
- Category
- C++
- Title
- how to find the number of cycles in a graph C++
- Category
- C++
- Title
- run cmd command c++
- Category
- C++
- Title
- if vector contains value c++
- Category
- C++
- Title
- self in c++
- Category
- C++
- Title
- c++ ternary operator
- Category
- C++
- Title
- first fit algorithm
- Category
- C++
- Title
- powers of 2 in cpp
- Category
- C++
- Title
- clear console c++
- Category
- C++
- Title
- convert string to stream c++
- Category
- C++
- Title
- how to compare lower case character to uppercase cpp
- Category
- C++
- Title
- how to measure program run time in c++
- Category
- C++
- Title
- insertion c++
- Category
- C++
- Title
- binary representation differ in bits
- Category
- C++
- Title
- __builtin_ctz
- Category
- C++
- Title
- graph using djacency matrix c++
- Category
- C++
- Title
- variabvles in c++
- Category
- C++
- Title
- c++ method name
- Category
- C++
- Title
- new c++
- Category
- C++
- Title
- pause the console c++
- Category
- C++
- Title
- chess perft 5
- Category
- C++
- Title
- c++ return multiple values
- Category
- C++
- Title
- c++ public inheritance not getting protected
- Category
- C++
- Title
- nan c++ example
- Category
- C++
- Title
- how to convert n space separated integers in c++
- Category
- C++
- Title
- write to file in C++
- Category
- C++
- Title
- substitution failure is not an error
- Category
- C++
- Title
- level order traversal
- Category
- C++
- Title
- how to find hcf in c++
- Category
- C++
- Title
- create a bitset of 1024 bits,
- Category
- C++
- Title
- number of islands leetcode code
- Category
- C++
- Title
- initialize vector of vector c++
- Category
- C++
- Title
- insert at position in vector c++
- Category
- C++
- Title
- do while loop c++
- Category
- C++
- Title
- opperanf >> c++
- Category
- C++
- Title
- set of vectors c++
- Category
- C++
- Title
- set lower bound c++
- Category
- C++
- Title
- c++ excel cell blank cells
- Category
- C++
- Title
- console colors in C++
- Category
- C++
- Title
- getting a random letter in c++
- Category
- C++
- Title
- how can make string value in cpp
- Category
- C++
- Title
- stl sort in c++
- Category
- C++
- Title
- C++ w3schools
- Category
- C++
- Title
- basic ex of maps in c++
- Category
- C++
- Title
- c++ string to integer without stoi
- Category
- C++
- Title
- coping 2d vector in cpp
- Category
- C++
- Title
- c++ overloaded == operator
- Category
- C++
- Title
- cube mapping sdl
- Category
- C++
- Title
- c++ class constructor
- Category
- C++
- Title
- maximum subarray sum in c++
- Category
- C++
- Title
- C++ pointer arithmetic
- Category
- C++
- Title
- generate random double c++
- Category
- C++
- Title
- check for bst
- Category
- C++
- Title
- how to get a letter from the user c++ string
- Category
- C++
- Title
- int random string generator c++
- Category
- C++
- Title
- how to read and write in a file c++
- Category
- C++
- Title
- gcd function in c++
- Category
- C++
- Title
- c++ remove space from string
- Category
- C++
- Title
- how to create object in c++
- Category
- C++
- Title
- #include
- Category
- C++
- Title
- Find the duplicate in an array of N integers.
- Category
- C++
- Title
- create new file c++
- Category
- C++
- Title
- switch statement c++
- Category
- C++
- Title
- how to hide ui elements unity
- Category
- C++
- Title
- unordered_map c++
- Category
- C++
- Title
- cpp how to create an object of template class
- Category
- C++
- Title
- c++ code for polynomial addition
- Category
- C++
- Title
- getline not working c++
- Category
- C++
- Title
- remove element by index from vector c++
- Category
- C++
- Title
- c++ program to input and print text using Dynamic Memory Allocation.loop
- Category
- C++
- Title
- map arduino
- Category
- C++
- Title
- c++ do you not inherit constructor
- Category
- C++
- Title
- initialize map c++
- Category
- C++
- Title
- how to initialize an struct object in c++
- Category
- C++
- Title
- check if key exists in map c++
- Category
- C++
- Title
- c++ modulo make it give only positive numbers
- Category
- C++
- Title
- what is time complexity of min_element()
- Category
- C++
- Title
- c++ give options string
- Category
- C++
- Title
- c++ how to loop through a vector but not the last element
- Category
- C++
- Title
- how to compare two strings lexicographically in c++
- Category
- C++
- Title
- c++ dereference a pointer
- Category
- C++
- Title
- error: redefinition of ‘class Customer’
- Category
- C++
- Title
- array syntax in c++
- Category
- C++
- Title
- how to read a comma delimited file into an array c++
- Category
- C++
- Title
- c++ server service ros
- Category
- C++
- Title
- sqrt cpp
- Category
- C++
- Title
- c++ function return array
- Category
- C++
- Title
- how to make a n*n 2d dynamic array in c++
- Category
- C++
- Title
- string to vector c++
- Category
- C++
- Title
- c++ tutorial
- Category
- C++
- Title
- two sum problem in c++
- Category
- C++
- Title
- private and public in namespace cpp
- Category
- C++
- Title
- arrow operator c++
- Category
- C++
- Title
- ue4 modular character
- Category
- C++
- Title
- how to iterate through array in c++
- Category
- C++
- Title
- inverser les éléments d'un tableau manuellement en c++
- Category
- C++
- Title
- how read a shader from another file c++
- Category
- C++