Computer Science, asked by vishal5040, 1 year ago

Write a C program to generate the following pattern: 1

1 2

1 2 3

1 2 3 4

1 2 3 4 5​

Answers

Answered by PunithaPriya
1

#include<stdio.h>

int main()

{

int i,j,k,n;

printf(“Enter how many rows you want : “);

scanf(“%d”,&n);

for(i=1;i<=n;i++)

{

for(j=1;j<=i;j++)

printf(” %d”,j);

printf(“n“);

}

return 0;

}

thank u.,

hope it's helpful.,

Answered by Anonymous
0

Answer -

#include<stdio.h>

#include<conio.h>

void main ()

{

int n,i,j;

clrscr ();

printf("Enter any number");

scanf("%d",&n);

for(i=1;i<=n;i++)

{

printf("\n");

for(j=1;j<=i;j++)

{

printf("%d",j);

}

}

getch();

}

Similar questions