Multiply numbers after each other -


exercise product1ton (loop): write program called product1ton compute product of integers 1 10 (i.e., 1×2×3×...×10). try computing product 1 11, 1 12, 1 13 , 1 14. write down product obtained , explain results.

how can this, , multiple ways?

try this:

private int product1ton(int n){     int result = 1, ctr = 1;      while(ctr <= n){         result *= ctr++;     }      return result; } 

hope helps.


Comments

Popular posts from this blog

jquery - How can I dynamically add a browser tab? -

node.js - Getting the socket id,user id pair of a logged in user(s) -

keyboard - C++ GetAsyncKeyState alternative -