0

If i write num= 1 and (num<6) and num=num +1 the value comes 1-5 and if i wrote num=num+3 the value comes 1and 4 why this so

i m a bit confuse as in first case 5 numbers arrive but in second only two why this so

6th Apr 2018, 10:35 AM
Sahil Chauhan
Sahil Chauhan - avatar
2 Respostas
+ 2
Do you iterate in a loop? If yes then what happens is: Num = 1 <6 yes; +=1; output 2 Num = 2 <6 yes; += 1 output 3 ... Num= 5 <6 yes; += 1 output 5 Num = 6 <6 no stop, no output For the other case its more exreme. 1+3 is 4 (output 4), 4 + 3 is 7 (no output). Does that make sense? BR
6th Apr 2018, 10:56 AM
Marco Polidori
Marco Polidori - avatar
+ 1
wow you have explained me extremely clear thanx bro
6th Apr 2018, 11:10 AM
Sahil Chauhan
Sahil Chauhan - avatar