+ 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
2 Réponses
+ 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