+ 2

Prime Number

Someone could tell me if this code about prime numbers is it okay? Thanks #include <iostream> using namespace std; int main() { int rest=0; int num; int *dir_num; dir_num = &num; cout<<"Intrudicir un valor: "<<endl; cin>>num; for(int i=2; i<*dir_num; i++){ if((*dir_num%i)==0){ rest=*dir_num%i; rest++; } } if(rest%2!=0){ cout<<"El numero "<< *dir_num<< " NO es primo." << endl; cout<<"Posicion: "<< dir_num; } else{ cout<<"El numero "<< *dir_num << " SI es primo."<< endl; cout<<"Posicion: "<<dir_num; } return 0; }

20th Dec 2017, 1:35 AM
joffre jesús solórzano delgado
joffre jesús solórzano delgado - avatar
41 Answers
20th Dec 2017, 1:43 AM
James16
James16 - avatar
+ 3
@Charan Leo25 this is spam, please delete it :) Or write a normal answer so people can understand you :)
20th Dec 2017, 2:57 AM
James16
James16 - avatar
+ 3
👍
20th Dec 2017, 4:02 AM
Vyshnav Vishnu
Vyshnav Vishnu - avatar
+ 1
thansk you
20th Dec 2017, 1:54 AM
joffre jesús solórzano delgado
joffre jesús solórzano delgado - avatar
+ 1
If (x%2==0){ System.out.println("x is even number } else { System.out.println{"x is odd number}
21st Dec 2017, 6:06 AM
ravi
ravi - avatar
+ 1
give me your number and tell me country from u coz I have to search your isd code
21st Dec 2017, 6:24 AM
ravi
ravi - avatar
+ 1
i dont want to give out my number
21st Dec 2017, 6:27 AM
The Kid
The Kid - avatar
+ 1
what country do u live in
21st Dec 2017, 6:42 AM
The Kid
The Kid - avatar
+ 1
i tried
21st Dec 2017, 6:42 AM
The Kid
The Kid - avatar
+ 1
India
21st Dec 2017, 6:43 AM
ravi
ravi - avatar
+ 1
ur not popping up on whatsapp
21st Dec 2017, 6:43 AM
The Kid
The Kid - avatar
0
I don't know about this but I can give you easy way
21st Dec 2017, 6:04 AM
ravi
ravi - avatar
0
hey ravi
21st Dec 2017, 6:17 AM
The Kid
The Kid - avatar
0
i dont see ur whatsapp
21st Dec 2017, 6:17 AM
The Kid
The Kid - avatar
0
did u get my text ?
21st Dec 2017, 6:17 AM
The Kid
The Kid - avatar
0
tell me u r number with isd code
21st Dec 2017, 6:18 AM
ravi
ravi - avatar
0
isd code?
21st Dec 2017, 6:19 AM
The Kid
The Kid - avatar
0
ok save my number with 91
21st Dec 2017, 6:21 AM
ravi
ravi - avatar
0
what do u mean ?
21st Dec 2017, 6:22 AM
The Kid
The Kid - avatar
0
i wish solo learn had private message . it would make things way easier
21st Dec 2017, 6:22 AM
The Kid
The Kid - avatar