#include <stdio.h>
int main()
{
int lines=10;
int i,j;
int count;
for(i=1;i<=lines;i++){// this loop is used to print lines
count=0;
for(j=1;j<lines;j++){// this loop is used to print numbers in a line
if(count<i-1){
if(!(j<lines-i+1)){
printf("%d",j);
count++;
}
}
}
printf("0");
count=0;
for(--j;j>=1;j--){// this loop is used to print j and increment count
if(count<i-1){
printf("%d",j);
count++;
}
}
printf("\n");
}
return 0;
}
public class patter{
public static void main(String []args){
int lines=10;
int i,j;
int count;
for(i=1;i<=lines;i++){// this loop is used to print lines
count=0;
for(j=1;j<lines;j++){// this loop is used to print numbers in a line
if(count<i-1){
if(!(j<lines-i+1)){
System.out.print(j);
count++;
}
}
}
System.out.print("0");
count=0;
for(--j;j>=1;j--){// this loop is used to print j and increment count
if(count<i-1){
System.out.print(j);
count++;
}
}
System.out.println("");
}
}
}
using System;
public class Program
{
public static void Main()
{
int lines=10;
int i,j;
int count;
for(i=1;i<=lines;i++){// this loop is used to print lines
count=0;
for(j=1;j<lines;j++){// this loop is used to print numbers in a line
if(count<i-1){
if(!(j<lines-i+1)){
Console.Write(j);
count++;
}
}
}
Console.Write("0");
count=0;
for(--j;j>=1;j--){// this loop is used to print j and increment count
if(count<i-1){
Console.Write(j);
count++;
}
}
Console.WriteLine("");
}
}
}
$lines=10;
$i;
$j;
$count;
for($i=1;$i<=$lines;$i++){// this loop is used to print lines
$count=0;
for($j=1;$j<$lines;$j++){// this loop is used to print numbers in line
if($count<$i-1){
if(!($j<$lines-$i+1)){
echo $j;
$count++;
}
}
}
echo '0';
$count=0;
for(--$j;$j>=1;$j--){//this loop is used to print j and increment count
if($count<$i-1){
echo $j;
$count++;
}
}
echo "<br>";
}
lines=10
i=1
j=1
count=0
while i<=lines: #this loop is used to print lines
count=0
j=1
while j<lines: # this loop is used to priont numbers in a line
if count<i-1:
if j<lines-i+1:
count=count
else :
print(j, end='', flush=True)
count=count+1
j=j+1
print("0", end='', flush=True)
count=0
j=j-1
while j>=1: #this loop is used to print j and increment count
if count<i-1:
print(j, end='', flush=True)
count=count+1
j=j-1
print("")
i=i+1
C Program:
Output:
Java Program:
Output:
C# Program:
Output:
PHP Program:
Output:
Python Program:
Output: