C program to print square number pattern 3

Ex: Write a C program to print square number pattern 3. How to write a C program to print square number pattern 3. C program to print square number pattern 3.


Input from user:

Enter the number: 5


Expected output:

12345

12345

12345

12345

12345



Given pattern is same as previous square number pattern 2:

11111

22222

33333

44444

55555


Difference is:

In this pattern we only need to replace the value of i with value of .




Program:


#include<stdio.h>

void main()

{

int no;

int i,j;

printf("Enter the number:");

scanf("%d",&no);

/*Loop to print rows */

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

{

          /*Loop to print columns */

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

{

/*print value of j*/

                   printf("%d",j);

}

/*for new line*/

printf("\n");

}

}


Above program shows the following output:


C program to print square number pattern

No comments:

Post a Comment

If you have any doubts, please discuss here...👇