Rhombus Star Pattern in C language using For loop
ADVERTISEMENTS
Rhombus star pattern in C language using for loop. In this article, you will learn how to print the rhombus star pattern in c language using for loop.
Source Code
// Rhombus Star Pattern in C language using For loop
#include <stdio.h>
int main() {
int x, i, j;
// x - To store the number of rows
printf("-----Enter the total number of rows-----\n");
scanf("%d", &x);
for (i = 1; i <= x; i++) {
// print the spaces
for (j = i; j < x; j++)
printf(" ");
// print the stars
for (j = 1; j <= x; j++)
printf("*");
printf("\n");
}
return 0;
}
Output
-----Enter the total number of rows-----
6
******
******
******
******
******
******