0 votes
157 views
in C programming by (98.9k points)
edited by

Write a program to display patterns by accepting row number as an input.

Pattern 1

1

1 2

1 2 3

Do modification in above program to display following pattern

 

Pattern 2

1

2 2

3 3 3

1 Answer

0 votes
by (98.9k points)
edited by
 
Best answer

Do modification in above program to display following pattern

#include<stdio.h>
#include<conio.h>
#include<math.h>
void main ()
{
	int r,i,j;
	printf("Enter number of rows :\n");
	scanf("%d",&r);

	for(i=1;i<=r;++i)
	{
	for(j=1;j<=i;++j)printf("%d  ",i);
	printf("\n");
	}
	getch();
}

 

Related questions

0 votes
1 answer 97 views
0 votes
1 answer 112 views

Doubtly is an online community for engineering students, offering:

  • Free viva questions PDFs
  • Previous year question papers (PYQs)
  • Academic doubt solutions
  • Expert-guided solutions

Get the pro version for free by logging in!

5.7k questions

5.1k answers

108 comments

504 users

...