KnowledgeHub
Questions
Tags
Users
Search
Alex Rivera
|
Logout
Edit Question
Title
Body
I'm building a program for the Euler projects question 3, and while that might not really matter as a result I'm current trying to make this code take a number and test if it is prime or not. Now then before I get to troubleshoot the function it gives me the error "floating point exception" right after inputting the number. Here's the code: int main() { int input; cout << "Enter number: " << endl; cin>> input; int i = input/2; int c; for (i>0; i--;) { c= input%i; if (c==0 || i == 1) cout << "not prime" << endl; else cout << "prime" << endl; } return 0; } so essentially why is it giving me a floating point exception and what does that even mean?
Tags (comma-separated)
Save Edits
Cancel