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

Popular posts from this blog

c - Mpirun hangs when mpi send and recieve is put in a loop -

python - Apply coupon to a customer's subscription based on non-stripe related actions on the site -

java - Unable to get JDBC connection in Spring application to MySQL -