RicardasSim

while, do while

Dec 22nd, 2022
875
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.29 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4.  
  5. int main() {
  6.  
  7.     int a = 11;
  8.  
  9.     while ( a < 10 )
  10.     {
  11.         printf("loop1\n");
  12.         a++;
  13.     }
  14.  
  15.     do
  16.     {
  17.         printf("loop2\n");
  18.         a++;
  19.     }
  20.     while ( a < 10 );
  21.    
  22.  
  23.     return 0;
  24. }
  25.  
  26. /*
  27. output:
  28.  
  29. loop2
  30.  
  31. */
Advertisement
Add Comment
Please, Sign In to add comment