i was wondering why did we use count++ instead of for example count += 0 to count the number of even numbers?
#include <iostream>
using namespace std;
int main()
{
int count = 1;
for (int i = 0; i <= 100; i++)
{
if (i % 2 == 0)
count += 0; // why it will give me only 1? as output
else
continue;
}
cout << "num of even: " << count << endl;
system("Pause");
return 0;
}
Aucun commentaire:
Enregistrer un commentaire