Solid Left Star Rhombus
*******
*******
*******
*******
*******
*******
*******
For printing the aforesaid pattern the number of lines is taken as input. The number of stars in each line is same as the number of lines of the pattern. That means if there are n numbers of lines then there are n numbers of stars at each line. the number of spaces before printing the stars is n-i for ith line. Three for loops are used here, the outer for loop is used to count the number of lines. The first inner for loop is used to print the spaces before the star at each line. the second inner for loop is used to print the stars of each line.
INPUT: the number of lines
OUTPUT: the aforesaid pattern
PROCESS:
Step 1: [taking the input]
Read n [number of lines]
Step 2: [printing the pattern]
For i=1 to n repeat
For j=1 to n-I repeat
Print " "
[End of ‘for’ loop]
For k=1 to n repeat
Print "*"
[End of ‘for’ loop]
Move to the next line
[End of ‘for’ loop]
Step 3: Stop.
for(i=1;i<=n;i++)------------------------------------------ n
{ //printing the spaces
for(j=1;j<=n-i;j++)------------------------------ n-i
printf(" ");
//printing the stars
for(k=1;k<=n;k++)------------------------------- n
printf("*");
printf("\n");
}
The complexity is: O(n*(n-i+n))=O()
Contributed by