Answer the question
In order to leave comments, you need to log in
Please explain at what point in the code I got a random number in the output?
#include <iostream>
int main() {
int a = 4668;
int b = 10415;
int c;
for(int i=a; i<b; i++) {
if(i%3==0 || i%11==0) {
if(i%2!=0 && i%13!=0 && i%22!=0 && i%33!=0) {
c++;
}
}
}
std::cout << c << "\n";
}
[email protected]:~/VS Code/test$ g++ programm.cpp -o programm
[email protected]:~/VS Code/test$ ./programm
1680771509
[email protected]:~/VS Code/test$ ./programm
-1092250235
[email protected]:~/VS Code/test$ ./programm
-1058511643
[email protected]:~/VS Code/test$ ./programm
1213003333
[email protected]:~/VS Code/test$ ./programm
-359841931
[email protected]:~/VS Code/test$ ./programm
-127210811
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question