is x prime?
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(){
long long x;
cin>>x;
if(Is_Prime(x))cout<<"Is Prime";
else cout<<"Is not Prime";
}
Also in C++:
- Title
- vectors in c++ geeksforgeeks
- Category
- C++
- Title
- C++ Student::Student()
- Category
- C++
- Title
- getting a random letter in c++
- Category
- C++
- Title
- calling by reference and pointers c++
- Category
- C++
- Title
- initialize map c++
- Category
- C++
- Title
- power c++
- Category
- C++
- Title
- get data from terminal c++
- Category
- C++
- Title
- container class in c++
- Category
- C++
- Title
- c++ string^ to char*
- Category
- C++
- Title
- cpp loop through object
- Category
- C++
- Title
- *min_element in c++
- Category
- C++
- Title
- convert integer to string c++
- Category
- C++
- Title
- how to grab all of user input c++
- Category
- C++
- Title
- c++ program to input and print text using Dynamic Memory Allocation.loop
- Category
- C++
- Title
- goto c++
- Category
- C++
- Title
- pyqt connect
- Category
- C++
- Title
- calculate factorial
- Category
- C++
- Title
- programa para saber si un numero es primo
- Category
- C++
- Title
- check for bst
- Category
- C++
- Title
- c++ string to integer without stoi
- Category
- C++
- Title
- prefix sum array
- Category
- C++
- Title
- generate random double c++
- Category
- C++
- Title
- substitution failure is not an error
- Category
- C++
- Title
- checking an int in c++
- Category
- C++
- Title
- max in c++
- Category
- C++
- Title
- kruskal's algorithm c++ hackerearth
- Category
- C++
- Title
- pair c++
- Category
- C++
- Title
- index string c++
- Category
- C++
- Title
- leveling system c++
- Category
- C++
- Title
- conditional operator in cpp
- Category
- C++
- Title
- border radius layout android xml
- Category
- C++
- Title
- c++ compiler for sublime text
- Category
- C++
- Title
- two sum problem in c++
- Category
- C++
- Title
- translate
- Category
- C++
- Title
- removing repeated characters in a string c++
- Category
- C++
- Title
- binary tree search
- Category
- C++
- Title
- select elements from array C++
- Category
- C++
- Title
- case label in c++
- Category
- C++
- Title
- convert GLFWwindow* to IntPtr
- Category
- C++
- Title
- ios_base::sync_with_stdio(false);cin.tie(NULL);
- Category
- C++
- Title
- how to find the number of cycles in a graph C++
- Category
- C++
- Title
- counting valleys hackerrank solution in c++
- Category
- C++
- Title
- c++ print one line to console instead of multiple
- Category
- C++
- Title
- min heap priority queue c++
- Category
- C++
- Title
- how to use a new node c++
- Category
- C++
- Title
- converting char to int in c++
- Category
- C++
- Title
- c++ string contains
- Category
- C++
- Title
- c++ stack
- Category
- C++
- Title
- c++ show time elapsed
- Category
- C++
- Title
- solve linear equations geeksforgeeks
- Category
- C++
- Title
- minmax_element c++
- Category
- C++
- Title
- initialize 3d vector c++
- Category
- C++
- Title
- how to make a switch case statement in c++
- Category
- C++
- Title
- iterate through unordered_map c++ in reverse order
- Category
- C++
- Title
- class is replace by structure
- Category
- C++
- Title
- add a timer c++
- Category
- C++
- Title
- c++ find object in vector by attribute
- Category
- C++
- Title
- namespace c++
- Category
- C++
- Title
- gta san andreas
- Category
- C++
- Title
- clear file before writing c++
- Category
- C++
- Title
- c++ unittest in ros
- Category
- C++
- Title
- how to check type in c++
- Category
- C++
- Title
- how to declare a vector in c++
- Category
- C++
- Title
- c++ ros subscriber
- Category
- C++
- Title
- char* to int in cpp
- Category
- C++
- Title
- first prime numbers
- Category
- C++
- Title
- c++ movment
- Category
- C++
- Title
- c++ random numbers
- Category
- C++
- Title
- c++ find prime numbers
- Category
- C++
- Title
- mark occurances of elements in array cpp
- Category
- C++
- Title
- c++ typedef
- Category
- C++
- Title
- maximum possible number atmost k swaps
- Category
- C++
- Title
- c++ code to print hello world
- Category
- C++
- Title
- body parser
- Category
- C++
- Title
- pbds in c++
- Category
- C++
- Title
- first fit algorithm
- Category
- C++
- Title
- merge sort in c++
- Category
- C++
- Title
- c++ write string
- Category
- C++
- Title
- std string find character c++
- Category
- C++
- Title
- delete a double pointer c++
- Category
- C++
- Title
- c++ clear console
- Category
- C++
- Title
- range based for loop c++
- Category
- C++
- Title
- knapsack
- Category
- C++
- Title
- create a 2d array c++
- Category
- C++
- Title
- c++ menu selection with arrow keys
- Category
- C++
- Title
- how to cout in c++
- Category
- C++
- Title
- list conda environments
- Category
- C++
- Title
- arrays in C++
- Category
- C++
- Title
- dijkstra c++ geeksforgeeks using set
- Category
- C++
- Title
- runtime error in c++
- Category
- C++
- Title
- C++ int to char*
- Category
- C++
- Title
- how to get a letter from the user c++ string
- Category
- C++
- Title
- runtime array size c++
- Category
- C++
- Title
- how to sort an array c++
- Category
- C++
- Title
- c++ looping through a vector
- Category
- C++
- Title
- unordered_set c++
- Category
- C++
- Title
- Get handle in C++
- Category
- C++
- Title
- screen record ios simulator
- Category
- C++
- Title
- cs1955 unity vector3
- Category
- C++
- Title
- how to delete an element in vector pair in cpp
- Category
- C++