Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- int main(void)
- {
- int num = 0;
- int i = 0;
- int j = 0;
- //declaring vars
- do{
- printf("Enter a number between 5 and 20: " );
- scanf("%d", &num);
- getchar();
- }while(!(5 < num && 20 > num));
- //ask for a number until there's a valid input (5<num<20)
- for(i = 1; i < num + 1; i++){
- for(j = 0; j < i; j++){
- printf("*");
- }
- //prints * for the value of i
- printf("\n");
- //goes a row down
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement