0
I want to get the following output:
n:4
+
++
+++
++++
That is, I insert an "n" and I will get a kind of triangle in which the base corresponds to a number of asterisks that is requested by input. I made the following code but this just hits the number of lines and not elements per line:
System .out . println("Indique um número inteiro positivo:");
int n = scanner.nextInt();
int triangulos = 0;
int i ;
for(i=0; triangulos < n ; triangulos++)
{
System.out.println("n:" + n);
System.out.println("*");
}
The triangle is half over. It doesn’t have to be a full triangle?
– user28595
Another
for
to generate the asterisks– Isac
Your asterisks have missing legs
– Bacco