hi so I'm trying to do this challenge(in the title) I have an idea of how to use the for loop. But I'm lost on how I'm going to output a dot every 100 iterations using modulo. I'd like to know how to do this using modulo.
// for loop running 50 times
for(int i = 0; i < 50; i++){
// if i mod 5 is equal to zero
if(i%5 == 0){
// print out a dot and the value of 5
cout << "." << " i = " << i << endl;
}
}
maybe a for loop with an if statement that test if the variable of the for loop is modulus of 100 == 0 print " . ". Else continue. remember to make sure all of this in the scope of the for loop. Let me know if this works... Also if you show the code it helps us see where your going wrong.
PLEASE use the following resources to define how to apply your code to the form:
PLEASE
Especially if it doesn't work. Note that this is only an idea if it doesnt work show the code and will trouble shoot or rethink other possible solutions.
*** Im leaving out a few basic details for you to try and figure out... Any more questions..."Show the code please"
i thought about using the if statement but I just couldn't figure out the condition. But now it's pretty clear to me. the condition is if( i%100==0) because every number that divides evenly by 100 should leave 0 remainder. I get it now. Thanks everyone!