Hey, It is not the exact logic for a given program.
Here i m giving the code with minimum number of executing steps.
also i m sure that there doesn't exist any other way to print the same Diamond such that code executing steps will be less than mine.
It is not copied from any website, book etc.
#include
void main()
{
int n,i,s,k,flagReverce=0;
printf("Enter the no. of rows\n");
scanf("%d", &n);
for (i=1; i>=1; i++)
{
for (s=n; s>i; s-)
printf(" ");
for(k=1; k<(i*2)-1; k++)
printf("*")
printf("\n")
if (i == n)
flagReverce = 1
if (flagReverce = 1)
i-=2
}
}
Copyright © 2026 eLLeNow.com All Rights Reserved.