C Online Compiler
Example: Rhombus Star Pattern in C language using For loop
C
C++
C#
Java
Python
PHP
main.c
STDIN
Run
// 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; }
6
Output
Clear
ADVERTISEMENTS