0
Please help me find the bug in my code
The output of my code is undesirable,when i give the number 10 as input,I'm getting output of a series of numbers and then the factors are displayed below. ...please help me fix my code so that the output is only factors. https://code.sololearn.com/c12qm3lhEPO4/?ref=app
2 Réponses
+ 3
You want the factors of 'number', so you should check if number%i is 0
for(unsigned int i=1; i<=number; ++i)
{
if (number%i == 0)
{
cout << i << "\n";
}
}
Without using arrays or VLAs (which are illegal in C++)
0
Thank you to everyone who took time to revise my code ...you guyz I've been great help.....this is my new and improved program stemmed from all your feedback
https://code.sololearn.com/cW2GCJ1k1tXm/?ref=app