c++ - For loop and printing some values -
I have this loop with these variables which prints twice.
int size = 3; Int number = 4; Int i; For (i = 0; i & lt; num - 1; ++ i) {fprintf (stdout, "% i \ n", i ..?); Fprintf (stdout, "% i \ n", i ... ??); } How can I make expressions for fprintf so that the loop runs and prints 3 times:
0
2
3
6
8
I'm not sure I have interpreted the sequence correctly - but at least this will work for the nubers you give:
int size = 3; Int number = 4; Int i; For (i = 0; i & lt; num - 1; ++ i) {fprintf (stdout, "% i \ n", i * 3); Fprintf (stdout, "% i \ n", i * 3 + 2); }
Comments
Post a Comment