fork download
  1. #include<stdio.h>
  2.  
  3. int main() {
  4. int n = 7; // troque pelo scanf para ler o valor do n
  5.  
  6. int total = n;
  7. while (n > 0) {
  8. for(int i = 0; i < total - n; i++) {
  9. printf("x");
  10. }
  11. for(int i = 1; i <= n; i++) {
  12. printf("%d", i);
  13. }
  14. n--;
  15. printf("\n"); // pula a linha
  16. }
  17. return 0;
  18. }
  19.  
Success #stdin #stdout 0s 5640KB
stdin
Standard input is empty
stdout
1234567
x123456
xx12345
xxx1234
xxxx123
xxxxx12
xxxxxx1