#include
using namespace std;
int main()
{
int n=4,num=n-1;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
cout<<num;
num++;
cout<<endl;
}
num--;
for(int i=n;i>=1;i--)
{
for(int j=1;j<=i;j++)
cout<<num;
num--;
cout<<endl;
}
return 0;
}
#include
using namespace std;
int main()
{
int n=4,num=n-1;
for(int i=1;i<=n;i++)
{
for(int j=1;j<=i;j++)
cout<<num;
num++;
cout<<endl; } num–; for(int i=n;i>=1;i–)
{
for(int j=1;j<=i;j++)
cout<<num;
num–;
cout<<endl;
}
return 0;
}
public class Pattern {
public static void main(String[] args) {
int N=4;
for(int i=1;i<=N;i++) {
for(int j=1;j<=i;j++) System.out.print(i+2); System.out.println(); } for(int i=N-1;i>=1;i–) {
for(int k=1;k<=i;k++) System.out.print(i+2);
System.out.println();
}
}
}
Code is not available yet, comment down the code below the page in the comment section using the same logic or different approach you want to.
import java.util.*;
public class main {
public static void main(String args[])
{
Scanner sc=new Scanner(System.in);
int num=3;
for(int i=1;i<=4;i++)//loop for printing till line 4
{
for(int j=0;j=1;i–)//loop for printing from line 5 to 7
{
for(int j=0;j<i;j++)
{
System.out.print(num2);
}
System.out.print("\n");
num2–;
}
}
}
#include
using namespace std;
int main() {
int n;
cin>>n;
int m=n;
for(int i=0; i<n+1; i++)
{
for(int j=0; j<=i; j++)
cout<<m;
m++;
cout<=0; i–)
{
m–;
for(int j=0; j<=i; j++)
cout<<m;
cout<<endl;
}
return 0;
}