What is the output of the following program Show all your wo
Solution
Output:
9
12
15
8
9
10
11
12
Explanation:
function1 will execute when the i value is lesss then 5 . if it is 5 or more than the function2 will execute.
for i values 2,3,4 ...function1 will execute.
for i=2, function1 will return 9 function(3,3)===>return(3+2*3)
for i=3, function1 will return 12 function(4,4)===>return(4+2*4)
for i=4, function1 will return 15 function(5,5)===>return(5+2*5)
for i values 5,6,7,8,9 ...function2 will execute.
for i=5, function2 will return 8 function(5,5)===>return(2*5+1)
for i=6, function2 will return 9 function(6,6)===>return(2*6+1)
for i=7, function2 will return 10 function(7,7)===>return(2*7+1)
for i=8, function2 will return 11 function(8,8)===>return(2*8+1)
for i=9, function2 will return 12 function(9,9)===>return(2*9+1)
