Give the output in the following function and also write what mathematical operation it carries out if value of n = 10:
void test1(int n) {
for(int i=1; i< = n; i++) {
System.out.println (++i); }
}
Answers
Answered by
5
As per your algorithm you've used, it's incrementing the value of i twice and so the result comes out to be 2 4 6 8 10
Similar questions