#include <stdio.h>
main()
{
int row, col, n, temp;
printf("\n(There is) none worthy of worship except Allah(Subhanahu wa ta'ala).Muhammad(Sallallahu alayhi wasallam) is Messenger of ALLAH(Subhanahu wa ta'ala).\n");
printf("Enter the number of rows in Diamond of stars you wish to see: ");
scanf("%d",&n);
temp = n-1;
for ( row = 1 ; row <= n ; row++,temp-- )
{
for ( col = 1 ; col <= temp ; col++ )
{
printf(" ");
}
for ( col = 1 ; col <= 2*row - 1 ; col++ )
{
printf("*");
}
printf("\n");
}
temp = 1;
for (row = 1; row <= n; row++,temp++)
{
for (col = 1; col <= temp; col++)
{
printf(" ");
}
for (col = 1 ; col <= 2*(n-row)-1; col++)
{
printf("*");
}
printf("\n");
}
}
main()
{
int row, col, n, temp;
printf("\n(There is) none worthy of worship except Allah(Subhanahu wa ta'ala).Muhammad(Sallallahu alayhi wasallam) is Messenger of ALLAH(Subhanahu wa ta'ala).\n");
printf("Enter the number of rows in Diamond of stars you wish to see: ");
scanf("%d",&n);
temp = n-1;
for ( row = 1 ; row <= n ; row++,temp-- )
{
for ( col = 1 ; col <= temp ; col++ )
{
printf(" ");
}
for ( col = 1 ; col <= 2*row - 1 ; col++ )
{
printf("*");
}
printf("\n");
}
temp = 1;
for (row = 1; row <= n; row++,temp++)
{
for (col = 1; col <= temp; col++)
{
printf(" ");
}
for (col = 1 ; col <= 2*(n-row)-1; col++)
{
printf("*");
}
printf("\n");
}
}
No comments:
Post a Comment