Piràmide invertida


Submit solution

Points: 10
Time limit: 5.0s
Memory limit: 256M

Author:
Problem types
Allowed languages
C#, Go, Java

Escriviu un programa Java que imprimeixi un patró d'asteriscs utilitzant bucles niats. El programa ha de demanar a lusuari un nombre enter positiu i després imprimir un patró en forma de triangle rectangle invertit. Per exemple, si el número ingressat és 5, el programa ha d'imprimir el següent:

*****
****
***
**
*

Input Format

Primera línia:

  • \(n\): La mida del triangle.

Constraints

  • \(n >= 0\)

Output Format

  • Cal mostrar el triangle fent servir asteriscs.

Sample Input 0

5

Sample Output 0

*****
****
***
**
*

Sample Input 1

3

Sample Output 1

***
**
*

Sample Input 2

8

Sample Output 2

********
*******
******
*****
****
***
**
*

Sample Input 3

1

Sample Output 3

*

Sample Input 4

0

Sample Output 4

Explanation 4

  • No es mostra res per pantalla
CC BY-NC-SA 4.0