C C++ Java Data Structure Python JavaScript CSS Ajax PL/SQL PHP Puzzles C programs C++ programs Java programs

Home » C programs

C program for printing 'Rectangle' Pattern

In this C program, we are going to learn how to design a rectangle type of pattern using asterisk and loops (nested loops)?
Submitted by Shamikh Faraz, on February 16, 2018

In this program, we will learn, how we can print rectangle using ‘asterisks’ and ‘loops’?

C program

#include <stdio.h>

int main()
	int a, b, columns,rows;

	printf("Enter number of rows: ");

	printf("Enter number of columns: ");

	for(a=1; a<=rows; ++a)
		for(b=1; b<=columns; ++b)
			printf("* ");
	return 0;


Output - pattern of starts

You may also be interested in...

C/C++ Tips and Tricks...

Was this page helpful? YES NO

Are you a blogger? Join our Blogging forum.

Comments and Discussions