w3ajay

tally tutorial point, ms word 2013, ms excel 2013, ms powerpoint 2010,ccc question with answer in hindi 2021, Tally Prime in hindi , tally prime,Python,in python,programming in python,python

Wednesday, December 18, 2019

Diamond pattern program in C

code for Star in Diamond pattern program in C


#include <stdio.h>
#include<conio.h>
void main()
{
  int n, c, k;
clrscr();
  printf("Enter number of rows\n");
  scanf("%d", &n);
  for (= 1; k <= n; k++)
  {
    for (= 1; c <= n-k; c++)
      printf(" ");
    for (= 1; c <= 2*k-1; c++)
      printf("*");
    printf("\n");
  }
  for (= 1; k <= n - 1; k++)
  {
    for (= 1; c <= k; c++)
      printf(" ");
    for (= 1 ; c <= 2*(n-k)-1; c++)
      printf("*");
    printf("\n");
  }
  getch();
}

No comments:

Post a Comment

for more information please share like comment and subscribe