Can the while loop structure execute statements repeatedly when the expression is false? | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 1

Can the while loop structure execute statements repeatedly when the expression is false?

C

2nd May 2019, 6:12 AM
Prince Arafat
Prince Arafat - avatar
1 Answer
+ 3
Yes it can, just use the logical NOT operator to test the expression: #include <stdio.h> int main() { int i = 5; while(!(i > 9)) // start with false i++; printf("%d\n", i); }
2nd May 2019, 6:26 AM
Ipang