Computer Science, asked by MDRakib7826, 1 year ago

Write a Java program to print the pattern 1
1 1
1 2 1
1 3 3 1
1 4 6 4 1
1 5 10 10 5 1

Answers

Answered by saab7597
0

Answer:

Java program to print triangle or reverse triangle using any...

import java.util.Scanner;

public class Main {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int size = 0;

Character c;

System.out. println("Enter height of the triangle : ");

size = sc. nextInt();

Explanation:

int i, j;

char input, alphabet = 'A';

printf("Enter the uppercase character you want to print in last row: ");

scanf("%c",&input);

for(i=1; i <= (input-'A'+1); ++i)

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

printf("%c", alphabet);

}

Similar questions