Get Answers to all your Questions

header-bg qa

Write a JAVA program for the following pattern correctly- 12 53 6 84 7 9 10?

Answers (1)

best_answer

import java.util.*;

public class Test

public static void Pattern()

int i,j;

int k;

int n=4;

for(i=1; i<=n; i++)

k=i;

for(j=1; j<=i; j++)

System.out.print(k+" ");

k=k+n-j;

System.out.println();

public static void main(String args[])

Scanner sc=new Scanner(System.in);

int n=sc.nextInt();

Test t=new Test();

t.Pattern();

Posted by

Deependra Verma

View full answer