Răspuns:
Ex. 1)
int n,c;
citeste n;
cat timp (n<>0) executa
| c <- n%10;
| S <- S+c;
| n <- n/10;
----- sfarsit de cat timp
Ex. 2)
int n,c,max;
citeste n;
max <- 0;
cat timp (n<>0) executa
| c <- n%10;
| |daca (max< c) atunci
| | max <- c;
| -----sfarsit de daca
| n <- n/10;
-----sfarsit de cat timp
Explicație: