0
I’m not able to display the first 5 divisibles by 3, I put a counter variable, but it returns another number.
#include <stdio.h>
#include <stdlib.h>
int main()
{
int n = 20;
for(int i=1; i<=n; i++) {
if(i%3 == 0)
printf("%d\n", i);
}
return 0;
}
Could someone explain to me how?
Is displaying the numbers
3 6 9 12 15 18
, you want to show only the3 6 9 12 15
?– gato
Yes, that’s right. the first 5.
– user41646
Opa- take the opportunity to see in the answers the indentation styles of the code. It is much important to correctly indent all lines - helps you and others to read your own code much easier.
– jsbueno