Advertisement
thenewboston

C Programming Tutorial - 29 - break

Aug 22nd, 2014
427
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.40 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3. #include <ctype.h>
  4. #include <string.h>
  5. #include <math.h>
  6.  
  7. int main()
  8. {
  9.     int a;
  10.     int howMany;
  11.     int maxAmount = 10;
  12.  
  13.     printf("How many rows do you want to print? (up to 10) ");
  14.     scanf(" %d", &howMany);
  15.  
  16.     for(a=1; a<=howMany; a++){
  17.         printf("%d\n", a);
  18.         if(a==maxAmount){
  19.             break;
  20.         }
  21.     }
  22.  
  23.     return 0;
  24. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement