+ 1
I need help
I need to find all divisors of 2258 how to code it? #include <iostream> #include <math.h> using namespace std; int main() { int b; for(int i=0;i<2258;i++){ b=2258/i; if(b%b==0) cout<<i<<" "; }} but writing that is no output
9 Answers
+ 1
changed Code and it's working, thanks everyone
0
You put a ";" after your if statement when you test the modulus. Also you only need to do "if (2258 % i == 0)"
0
deleted ;
but it didn't help
0
try b=2258 and b%i
0
You are also dividing by zero on the first iteration. That will cause problems or even a crash. You cant divde by zero in c++
0
I tried this code, but no output again...((
0
or can u wright which numbers are outputed
0
changed Code and it's working, thanks everyone