What is the process ...in this prog.. | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 4

What is the process ...in this prog..

int num = 5; while (num > 0) { num--; if (num == 3) continue; printf("%d\n", num); }

9th Sep 2018, 9:18 AM
Sowmiya
Sowmiya - avatar
14 Answers
+ 7
num iz 5. Iz num > 0? YESSSS. Enter loop. num-- num iz now 4. Iz num 3? NOOOO. Print num. Print 4. Iz num > 0? YESSSS. num-- num iz now 3. Iz num 3? YESSSS. Continue. Iz num > 0? YESSSS. num-- num iz now 2. Iz num 2? NOOOO. Print num. Print 2. Iz num > 0? YESSSS. num-- num iz now 1. Iz num 3? NOOOO. Print num. Print 1. Iz num > 0? YESSSS. num-- num iz now 0. Iz num 3? NOOOO. Print num. Print 0. Iz num > 0? NOOOO. Exit loop. YAAYY
9th Sep 2018, 9:34 AM
Hatsy Rei
Hatsy Rei - avatar
+ 5
YAAAAAAY Sorry, had to do that.
9th Sep 2018, 9:49 AM
Yash✳️
Yash✳️ - avatar
+ 4
num-- returns the value of num and then increments num. Since you are not assigning num to anything, there is nothing else on the same line as num--. Nothing happens except for the decrement.
9th Sep 2018, 12:01 PM
Hatsy Rei
Hatsy Rei - avatar
+ 3
oh in this program u will never get output avoid silly mistakes
22nd Sep 2018, 5:42 PM
Sweet heart
Sweet heart - avatar
+ 2
yash can u pls explain the errors in my code name use.
9th Sep 2018, 12:07 PM
Sweet heart
Sweet heart - avatar
+ 2
what's ur doubt...
13th Sep 2018, 8:18 AM
Sowmiya
Sowmiya - avatar
+ 2
that's according to your code....if i can..then i will...
13th Sep 2018, 9:09 AM
Sowmiya
Sowmiya - avatar
+ 2
sowmiya hi
22nd Sep 2018, 9:24 AM
Sweet heart
Sweet heart - avatar
+ 2
hello...palak...
22nd Sep 2018, 11:18 AM
Sowmiya
Sowmiya - avatar
+ 1
hlo sowmiya
13th Sep 2018, 2:19 AM
Satheesh
Satheesh - avatar
+ 1
nega coding error clear panuviya
13th Sep 2018, 8:29 AM
Satheesh
Satheesh - avatar
0
num=5 ,then num-- =5 only na... how it become 4.. this is what my doubt is.. what is the difference between... --num &num--??
9th Sep 2018, 11:57 AM
Sowmiya
Sowmiya - avatar
0
ok frnzz.. sorry i undetstood... tanq...
9th Sep 2018, 12:00 PM
Sowmiya
Sowmiya - avatar
0
ya.. now cleared...
9th Sep 2018, 12:04 PM
Sowmiya
Sowmiya - avatar