How many times this for loop runs | Sololearn: Learn to code for FREE!
Nouvelle formation ! Tous les codeurs devraient apprendre l'IA générative !
Essayez une leçon gratuite
+ 2

How many times this for loop runs

int i=0,k=8; for(i=0;i <10&&k>5;i++,k--) cout <<"hello";

25th Sep 2017, 5:28 AM
vishal thakral
2 Réponses
+ 1
8-5=3 10-0=10 3 is smaller, hence 3
25th Sep 2017, 6:37 AM
👑 Prometheus 🇸🇬
👑 Prometheus 🇸🇬 - avatar
+ 3
3 the loop stops when k=5
25th Sep 2017, 5:51 AM
MBZH31
MBZH31 - avatar