Print This Pattern Star Triangle Odd
Source code :-
#include<stdio.h>
int main()
{
int n,j,i;
printf("Enter the numbers of rows: ");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
for(j=i;j<n;j++)
{
printf(" ");
}
for(j=1;j<2*i;j++)
{
printf("*");
}
printf("\n");
}
return 1;
}
Input-Output :-
abhi@hp-15q-laptop:~$ gcc p2.c
abhi@hp-15q-laptop:~$ ./a.out
Enter the numbers of rows: 5
*
***
*****
*******
*********
Post a Comment