primos menores que
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(){
//primes less than n
int n;
cin>>n;
int primes=0,i=1;
while(primes++<n){
while(!Is_Prime(++i));
cout<<i<<" ";
}
}
Also in C++:
- Title
- c++ initialization list
- Category
- C++
- Title
- binary representation differ in bits
- Category
- C++
- Title
- c++ delet from memory
- Category
- C++
- Title
- check for bst
- Category
- C++
- Title
- c++ string
- Category
- C++
- Title
- howt o initialize 3d vector in c++
- Category
- C++
- Title
- primos menores que
- Category
- C++
- Title
- singleton c++
- Category
- C++
- Title
- c++ string to int
- Category
- C++
- Title
- rand c++
- Category
- C++
- Title
- how to open an input file in c++
- Category
- C++
- Title
- how to check datatype of a variable in c++
- Category
- C++
- Title
- c++ convert const char* to LPCWSTR
- Category
- C++
- Title
- pair in c++
- Category
- C++
- Title
- calling by reference and pointers c++
- Category
- C++
- Title
- min heap priority queue c++
- Category
- C++
- Title
- c++ lettura file
- Category
- C++
- Title
- how to format decimal palces in c++
- Category
- C++
- Title
- c++ char print width
- Category
- C++
- Title
- assegnare valori in c++
- Category
- C++
- Title
- switch case sinax c++
- Category
- C++
- Title
- rick astley - never gonna give you up
- Category
- C++
- Title
- sqrt in c++
- Category
- C++
- Title
- fast input output in c++
- Category
- C++
- Title
- c++ while loop code
- Category
- C++
- Title
- stack function in cpp
- Category
- C++
- Title
- transpose matrix eigen c++
- Category
- C++
- Title
- getch c++ library
- Category
- C++
- Title
- what is time complexity of insertion sort
- Category
- C++
- Title
- insert elements in array in c++11
- Category
- C++
- Title
- appending a double to a string c++
- Category
- C++
- Title
- c++ print one line to console instead of multiple
- Category
- C++
- Title
- container class in c++
- Category
- C++
- Title
- c++ throw exception
- Category
- C++
- Title
- clear file before writing c++
- Category
- C++
- Title
- unsorted array to bst
- Category
- C++
- Title
- building native binary with il2cpp unity
- Category
- C++
- Title
- stringstream in c++
- Category
- C++
- Title
- strchr function in c++
- Category
- C++
- Title
- hohw toparse a string in c++
- Category
- C++
- Title
- opperanf >> c++
- Category
- C++
- Title
- rosrun actionlib_msgs genaction.py
- Category
- C++
- Title
- c++ movment
- Category
- C++
- Title
- ue4 c++ struct
- Category
- C++
- Title
- user input c++
- Category
- C++
- Title
- & in xml
- Category
- C++
- Title
- loop c++
- Category
- C++
- Title
- console colors in C++
- Category
- C++
- Title
- c++ switch case statement
- Category
- C++
- Title
- create a dictionary cpp
- Category
- C++
- Title
- c++ write string
- Category
- C++
- Title
- hobo 8
- Category
- C++
- Title
- two sum problem in c++
- Category
- C++
- Title
- cout console
- Category
- C++
- Title
- prefix sum array
- Category
- C++
- Title
- size of a matrix using vector c++
- Category
- C++
- Title
- how to type cast quotient of two integers to double with c++
- Category
- C++
- Title
- generate random double c++
- Category
- C++
- Title
- delete files c++
- Category
- C++
- Title
- index string c++
- Category
- C++
- Title
- opencv compile c++
- Category
- C++
- Title
- c++ wait for user input
- Category
- C++
- Title
- google spreadsheets add two strings
- Category
- C++
- Title
- split 2d array into chunks in c++
- Category
- C++
- Title
- Operator overloading in C++ Programming
- Category
- C++
- Title
- how to find hcf in c++
- Category
- C++
- Title
- how to concatinate two strings in c++
- Category
- C++
- Title
- is TLE means my code is correct but taking more time to computr
- Category
- C++
- Title
- repeating character in c++
- Category
- C++
- Title
- sieve of eratosthenes c++
- Category
- C++
- Title
- cin.ignore
- Category
- C++
- Title
- c++ do you not inherit constructor
- Category
- C++
- Title
- count number of zeros in array in O(logN)
- Category
- C++
- Title
- c++ scanf
- Category
- C++
- Title
- what is meaning of 64 bit integer in c++
- Category
- C++
- Title
- c++ isalphanum
- Category
- C++
- Title
- never gonna give you up
- Category
- C++
- Title
- dijkstra in c++
- Category
- C++
- Title
- c++ for loop syntax
- Category
- C++
- Title
- convert int to binary string c++
- Category
- C++
- Title
- convert char to string - c++
- Category
- C++
- Title
- check if key exists in map c++
- Category
- C++
- Title
- c++ random numbers
- Category
- C++
- Title
- sfml base program
- Category
- C++
- Title
- zeros of array c++
- Category
- C++
- Title
- string substr c++
- Category
- C++
- Title
- caesar cipher program in c++
- Category
- C++
- Title
- basic ex of maps in c++
- Category
- C++
- Title
- c++ reverse vector
- Category
- C++
- Title
- to_string c++
- Category
- C++
- Title
- vector stl c++
- Category
- C++
- Title
- c++ how to make a negative float positive
- Category
- C++
- Title
- iterative preorder traversal
- Category
- C++
- Title
- c++ remove text file
- Category
- C++
- Title
- max element in array c++ stl
- Category
- C++
- Title
- convert decimal to binary in c++
- Category
- C++
- Title
- how to calculate inverse trigonometric values in c++
- Category
- C++
- Title
- c++ function return array
- Category
- C++
- Title
- translate
- Category
- C++
- Title
- binary search stl in c++
- Category
- C++