dmilicev

do-while_loop.c

Apr 11th, 2021 (edited)
221
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. /*
  2.  
  3.     do-while_loop.c
  4.  
  5.     Task from Akira Reiss
  6.     https://www.facebook.com/groups/177292205762971/user/100035107703976/
  7.  
  8.     https://www.facebook.com/photo/?fbid=491814215332164&set=gm.1867148806777294
  9.  
  10.  
  11.     You can find all my C programs at Dragan Milicev's pastebin:
  12.  
  13.     https://pastebin.com/u/dmilicev
  14.  
  15. */
  16.  
  17. #include <stdio.h>
  18.  
  19. int main(void)
  20. {
  21.     int i=1, number;
  22.  
  23.     printf("\n Enter number from 1 to 9 : ");
  24.     scanf("%d",&number);
  25.  
  26.     do {
  27.         printf("%3d", i++);
  28.     } while( i <= number );
  29.  
  30.     i = number - 1;
  31.     while ( i > 0 ) {
  32.         printf("%3d", i--);
  33.     }
  34.  
  35.     return 0;
  36.  
  37. } // main()
  38.  
RAW Paste Data Copied