Program to Print Pattern 18

Program to Print Pattern 18 on fibonacci, factorial, prime, armstrong, swap, reverse, search, sort, stack, queue, array, linkedlist, tree, graph, pattern, string etc.

Program to print the following pattern

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

Algorithm

1. Start
2. Let i be an integer number.
3. Let j be an integer number.
4. Let n be a integer number and initialize by 7.
5. Repeat step 6 to 8 until all value parsed.
6. Set i = 0 and check i<n;
7. Set j = 1 and check j <= i;
8. Print number j+1.
9. End

JAVA

```public class Pattern4
{
public static void main(String[] args)
{
int n = 5;
for(int i = 0 ; i <= n ; i++)
{
for(int j = 0 ; j < i ; j++)
{
System.out.print(j+1);
}
System.out.println("");
}
}
}
```

Python

```lastNumber = 6
for row in range(1, lastNumber):
for column in range(1, row + 1):
print(column),
print("")
```

C program

```#include <stdio.h>
int main()
{
int i,j,n;
n = 8;
for(i=1;i<6;i++)
{
for(j=1;j<=i;j++)
{
printf("%d",j);
}
printf("\n");
}
}
```

C# program

```using System;
public class Program
{
public static void Main(string[] args)
{
for (int row = 1; row <= 5; ++row)
{
for (int col = 1; col <= row; ++col)
{
Console.Write(col);
}
Console.WriteLine();
}
}
}
```

PHP program

```<?php
for (\$i = 1; \$i <= 5; \$i++)
{
for (\$j = 1; \$j <= \$i ; \$j++)
{
echo \$j;
}
echo "</br>";
}
?>
```

Related Links

Adjectives Ado Ai Android Angular Antonyms Apache Articles Asp Autocad Automata Aws Azure Basic Binary Bitcoin Blockchain C Cassandra Change Coa Computer Control Cpp Create Creating C-Sharp Cyber Daa Data Dbms Deletion Devops Difference Discrete Es6 Ethical Examples Features Firebase Flutter Fs Git Go Hbase History Hive Hiveql How Html Idioms Insertion Installing Ios Java Joomla Js Kafka Kali Laravel Logical Machine Matlab Matrix Mongodb Mysql One Opencv Oracle Ordering Os Pandas Php Pig Pl Postgresql Powershell Prepositions Program Python React Ruby Scala Selecting Selenium Sentence Seo Sharepoint Software Spellings Spotting Spring Sql Sqlite Sqoop Svn Swift Synonyms Talend Testng Types Uml Unity Vbnet Verbal Webdriver What Wpf