JAVA
java
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
import java.util.Scanner;
class Triangle
{
public static void main(String args[])
{
Scanner sc = new Scanner(System.in);
int a = sc.nextInt();
//half pyramid//
for (int c=1; c<=a; c++ ){
for(int b= 1; b<=c; b++) {
System.out.print(" o");
}
System.out.println("");
}
System.out.println("");
//pyramid//
for(int c=1; c<=a; c++){
for(int b=c; b<=a; b++){
System.out.print(" ");
}
for(int b=1; b<c; b++){
System.out.print(" o");
}
Enter to Rename, Shift+Enter to Preview
OUTPUT
Run