rombo

Zaid · October 14, 2021 · C++
#include <stdio.h>
#include <stdlib.h>
 
int main(void)
{
    printf("  **  ROMBO ASIMETRICO  **\n\n");
    int i, n, j, k, s;
    printf("  Diga cuanto debe medir el lado del rombo:  ");
    scanf(" %d", &n);
    for (i=0; i<n; i++)
    {
        for (j=0; j<n-i; j++)
        {
            printf(" ");
        }
        for (k=0; k<1+i; k++)
        {
            printf("*");
        }
        for (s=0; s<i; s++)
        {
            printf("*");
        }
        printf("\n");
    }
 
    for (i=n-1; i>=0; i--)
    {
        for (j=0; j<n-i; j++)
        {
            printf(" ");
        }
        for (k=0; k<1+i; k++)
        {
            printf("*");
        }
        for (s=0; s<i; s++)
        {
            printf("*");
        }
        printf("\n");
    }
    printf("\n");
    return 0;
}

Comments

Please sign up or log in to contribute to the discussion.