Javatpoint Logo
Javatpoint Logo

Usage of Nested loop

Let's see the simple program of printing a number pattern in respective languages.

Program in C

In this program, nested looping is used to create a number pattern. With each iteration of i, j is executed 'i' times. In 'C language', printf() function is used to print a pattern.

Program in C++

In this program, i is executed 5 times. Therefore, with each iteration of i, j is executed i times. In C++ language, cout object is used to print the pattern.

Program in C#

In this program, i is executed 5 times. Therefore, with each iteration of i, j is executed i times. In C# language, Console.Write() function is used to print the pattern.

Program in Java

In this program, i is executed 5 times. With each iteration of i, j is executed i times. In "java language", System.out.print() is used to print the pattern.

Program in JavaScript

In this program, i is executed 5 times. With each iteration of i, j is executed i times. In javascript, document.write() is used to print the pattern.

Program in Perl

In this program, $i is executed 5 times. With each iteration of $i, $j is executed $i times. In perl, printf() function is used to print the pattern.

Program in PHP

In this program, $i is executed 5 times. With each iteration of $i, $j is executed $i times. In PHP, echo keyword is used to print the pattern.

Program in Ruby

In this program, $i is executed 5 times. With each iteration of $i, $j is executed $i times. In ruby, print keyword is used to print the pattern on the screen.

Program in Swift

In this program, i is executed 5 times. With each iteration of i, j is executed i times. In swift, print function is used to print the pattern.

Output:

1
1 2
1 2 3 
1 2 3 4
1 2 3 4 5

Help Others, Please Share

facebook twitter pinterest