๐ unique shapes output using c programming ...
#include <stdio.h>
//@codewithsandhan
void main()
{
int i, j, a, k = 1;
while (k > 0)
{
printf(" \U0001F600 Enter a number : ");
scanf("%d", &a);
printf("\n\n");
for (i = a; i >= -a; i--)
{
for (j = -a; j <= a; j++)
{
if (i == 0 || j == 0 || i == -j || i == j || i == -a || i == a || j == -a || j == a || (j > -7 * a / 25 && j < 6 * a / 25 && i < 5 * a / 25 && i > -5 * a / 25))
{
printf("*");
}
else
{
printf(" ");
}
if (j == a)
{
printf("\n");
}
}
}
k++;
printf("\n\n");
}
Comments
Post a Comment