Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- /*Print following pattern
- *
- ***
- *
- ***
- ***
- *
- ***
- ***
- ***
- *
- ***
- ***
- ***
- ***
- */
- #include<stdio.h>
- int main()
- {
- int n,i,m=1,j,k;
- printf("please enter the number of lines:\n");
- scanf("%d",&n);
- for (i=1;i<=n;i++)
- { printf("* ");
- printf("\n");
- k=m;
- while(k)
- { if(i==n)
- break;
- i++;
- for(j=1;j<=3;j++)
- { printf("* ");
- }
- printf("\n");
- k--;
- }
- m++;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement