nomben in Binin
Problem 3 - show the 9325.768 decomal
BCD
and Gxcess - 3 Codes'
Answers
Answered by
0
import java.io.*;
import java.util.*;
public class Program {
public static void main(String []args) {
Scanner in = new Scanner(System.in);
System.out.print("Enter a number: ");
int n=in.nextInt();
for(int i=1;i<=n;i++) {
for(int j=i;j<=n-1;j++) {
System.out.print(" ");
}
for(int j=1;j<=i;j++) {
System.out.print(j);
}
for(int j=i-1;j>=1;j--) {
System.out.print(j);
}
System.out.println();
}
}
}
Output:
$ java Program
Enter a number: 4
1
121
12321
1234321
Similar questions
Business Studies,
3 months ago
Math,
3 months ago
Math,
6 months ago
Physics,
11 months ago
Social Sciences,
11 months ago
Chemistry,
11 months ago