Print Diamond pattern using C

preview_player
Показать описание
Printing Diamond Pattern Using Simple technique in C Language
Рекомендации по теме
Комментарии
Автор

Shortest and Smart code for diamond pattern in just 2 FOR loops..
Output verified on Turbo C IDE..

#include <stdio.h>
#include <math.h>
#include <conio.h>

void main()
{
int n, row, col, flag=0;
printf("Enter Number");
scanf("%d", &n);

for(row=1; row>=1; row++)
{
for(col=1; col<n*2; col++)
{

if(abs(n-col)+1>=row)
printf("*");
else
printf(" ");

}
printf("\n");

if(row==n)
flag=1;

if(flag==1)
row = row-2;
}

}

yuvrajadkar
Автор

It is very easy, after watching your video

shruti
Автор

It is not diamond brother... In diamond you must have max ⭐in centre line...

dwaipayandey
Автор

If you can tranzlet it will be better😆

التائبةإلىالله-هز
welcome to shbcf.ru