a)
*****
****
***
**
*
**
***
****
*****
b)
in loc de "cat timp j>=0 executa" se va scrie "cat timp j>=i executa"
c)
#include<iostream>
using namespace std;
int main() {
int n, b, j;
cin >> n;
for (int i = 1; i <= 2 * n - 1; i++) {
b = 0;
if (n - i < 0)
j = i - n;
else
j = n - i;
while (j >= 0) {
cout << '*';
j--;
b = 1;
}
if (b != 0)
cout << endl;
}
return 0;
}
d)
in loc de
|-daca n-i<0 atunci
| j<-i-n
| altfel
| j<-n-i
|_
se va scrie
j<- |n-i|