Pattern in C programming 

Hello, guys today we learn about user-inputted Pattern in C programming (User input the value of ROW and COLUMN) Using Nested loop. And get output with the explanation.

C program to print rectangle pattern

/* C program to print hollow rectangle star pattern */

#include <stdio.h>

int main()
{
int i, j, rows, columns;

/* Input number of rows and columns from user */
printf(“Enter number of rows: “);
scanf(“%d”, &rows);
printf(“Enter number of columns: “);
scanf(“%d”, &columns);

/* Iterate over each row */
for(i=1; i<=rows; i++)
{
/* Iterate over each column */
for(j=1; j<=columns; j++)
{
if(i==1 || i==rows || j==1 || j==columns)
{
/* Print star for 1st and last row, column */
printf(“*“);
}
else
{
printf(” “);
}
}

/* Move to the next line */
printf(“\n“);
}

return 0;

}

Pattern in C

Pattern in C programming
Pattern in C programming

Rectangle pattern in C programming 

 

Pattern in C programming
Pattern in C programming

END

C program to draw a square using graphics (clickHere)

C program to print rectangle pattern of Numbers 

Note:- Maybe sometime above code doesn’t get user-friendly output, in codeblock ‘or’ any other EDITOR, All of C & C++ program tested in DOS compiler Turbo C.

Also Read

Types of functions in C    Read Here

I hope you will understand better if you study at M.U, in the exam of M.U you know how important this “Pattern in C programming. So please don’t forget to give your valuable feedback. Go in the comment section and Give us some feedback about it. Pattern in C programming or My website.

Our team check your every Comment per day Because your one feedback helps us in growing Thesmolt

I request you if you have any doubt or question regarding our site, then please don’t hesitate. We always waiting for your Suggestion.

Note:- If you want to Download This article’s in PDF form, then simply go (Top or Bottom of) Right corner and click on the PRINT icon, and it’s saved as a PDF of  Pattern in C programming

For further questions, you can contact us Via mail [email protected]  otherwise, Our Help Page and Contact us Page, which is included below. I hope I’ll able to say all the possible ways to reach us. Or Download My Android Application Below Download Button.

thesmolt App

Leave a Reply

x