I need help with this code + collecting any good codes | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
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;}

29th Jun 2017, 4:38 PM
Anonymus_1_
2 Answers
+ 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
29th Jun 2017, 4:49 PM
Nura Programmer
Nura Programmer - avatar
0
oops, thanks it really helped...
29th Jun 2017, 7:03 PM
Anonymus_1_