+ 2

Prime number

#include <iostream> using namespace std; int main() { double n, i, j; cout<<"Please enter a number"<<endl; cin>>n; for(i=2; i<n; i++) { if( n % i == 0) cout<<"UnRishoni"; else cout<<"Rishoni :)"; } return 0; } Hi! Someone know what is the problem in my code? I try to check if the cin number is prime. The error checker tell me that I used in double and double to make % .. What is that mean? Thank you!

9th Dec 2017, 10:22 PM
Avihu
Avihu - avatar
3 Antworten
+ 1
But using int is better as less space would be needed keeping that extra zeroes behind.
9th Dec 2017, 11:21 PM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
0
Thank you!!!
10th Dec 2017, 12:58 AM
Avihu
Avihu - avatar