Table of Contents
In this article, we will discuss the rectangular or square star and number pattern in C using for loop
In the C Language, We can print various type of Rectangular shapes through nested for loop using number and special character
Examples
Program 1
#include <stdio.h>
#include <stdlib.h>
int main()
{
int row;
int coloum;
for(row=1; row<=10; row++){
for(coloum=1; coloum<=10; coloum++){
printf(“*”);
}
printf(“n”);
}
return 0;
}
When the above code is executed ,it produces the following result
program 2
#include <stdio.h>
#include <stdlib.h>
int main()
{
int row;
int coloum;
for(row=1; row<=10; row++){
for(coloum=1; coloum<=10; coloum++){
printf(“%d”,coloum);
}
printf(“n”);
}
return 0;
}
#include <stdio.h>
#include <stdlib.h>
int main()
{
int num, row, coloum;
printf(“Enter Number of row to be disply :n “);
scanf(“%d”,&num);
for(row=1; num>=row; row++)
{
for(coloum=1; coloum<=num; coloum++)
{
printf(“*”);
}
printf(“n”);
}
return 0;
}
When the above code is executed ,it produces the following result
Program 4
Multiply two numbers in Java using scanner| 5 different ways In this article, we will…
5 Different ways to Divide two numbers in Java using scanner In this article, we…
Learn 8 Ways to Subtract Two Numbers Using Methods in Java In this article, we…
10 ways to subtract two numbers in Java In this article, we will discuss the…
Java Code Examples – Multiply Two Numbers in 5 Easy Ways In this article, we…
How to Divide two numbers in Java| 5 different ways In this article, we will…
This website uses cookies.