The Gateway to Computer Science Excellence
First time here? Checkout the FAQ!
x
0 votes
49 views

what is the return value 8 or 6?

asked in Programming by Active (4.8k points) | 49 views
0
getting 8.
0
same here.
0
Test series question ? Answer given 6? I even ran it on compiler :P
0
yes, given as 6.

2 Answers

+1 vote
when k=0,2,3, result +=1

and k=1,4 result +=k

so result= 0+1+1+1+1+4=8

when k=5 loop terminates and result returned is 8
answered by Loyal (8.2k points)
0 votes
getting 8
answered by (19 points)

Related questions

Quick search syntax
tags tag:apple
author user:martin
title title:apple
content content:apple
exclude -tag:apple
force match +apple
views views:100
score score:10
answers answers:2
is accepted isaccepted:true
is closed isclosed:true
47,929 questions
52,326 answers
182,372 comments
67,797 users