0
I need help with this code + collecting any good codes
need some help... i have written this code in c ++ to define if user inpit can be divided by any number but 1 and input itself but it doesnt output anything here is my code : #include <iostream> using namespace std; int main() {int y = 1; int x; cin >> x; while (y < x/2){ if (x / y == 0){ cout << ''it is not''; return 0;} else;{ y++} if (y == x/2 - 0.5){ cout >> '' it is"; return 0;}} return 0;}
2 Antworten
+ 2
Just replace any where with cout>> , and put cout<<
that is your mistake.
and also don't forget to include <stdlib.h>
then before any return statement, use this,
system("PAUSE");
this help to see your result, since by default the cmd will popup and close it self immediately after the program terminate with
0
oops, thanks it really helped...