SHARE
TWEET

Untitled

a guest Dec 8th, 2019 78 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3.  
  4. int main(void)
  5. {
  6.     int num = 0;
  7.     int i = 0;
  8.     int j = 0;
  9.     //declaring vars
  10.    
  11.     do{
  12.     printf("Enter a number between 5 and 20: " );
  13.     scanf("%d", &num);
  14.     getchar();
  15.     }while(!(5 < num && 20 > num));
  16.     //ask for a number until there's a valid input (5<num<20)
  17.    
  18.     for(i = 1; i < num + 1; i++){
  19.        
  20.         for(j = 0; j < i; j++){
  21.             printf("*");
  22.         }
  23.         //prints * for the value of i
  24.         printf("\n");
  25.         //goes a row down
  26.     }
  27.    
  28.     return 0;
  29. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top