fork download
  1. #include <stdio.h>
  2. #include <string.h>
  3. #define TURMAS 2
  4. #define ALUNOS 10
  5.  
  6. int main() {
  7. char nomes[ALUNOS][TURMAS][31];
  8. for (int j = 0; j < TURMAS; j++) {
  9. printf("\nTurma %d:\n", j + 1);
  10. for (int i = 0; i < ALUNOS; i++) {
  11. printf("Aluno: ");
  12. scanf("%30s", nomes[i][j]);
  13. }
  14. }
  15. printf("\nTurma 1: Turma 2:\n");
  16. for (int i = 0; i < ALUNOS; i++) {
  17. printf("%s", nomes[i][0]);
  18. for (int j = 1; j < TURMAS; j++) printf("%30s", nomes[i][j]);
  19. printf("\n");
  20. }
  21. }
  22.  
  23. //https://pt.stackoverflow.com/q/500054/101
Success #stdin #stdout 0s 4980KB
stdin
a
b
c
d
e
f
g
h
i
j
k
l
m
n
o
p
q
r
s
t
stdout
Turma 1:
Aluno: Aluno: Aluno: Aluno: Aluno: Aluno: Aluno: Aluno: Aluno: Aluno: 
Turma 2:
Aluno: Aluno: Aluno: Aluno: Aluno: Aluno: Aluno: Aluno: Aluno: Aluno: 
Turma 1:                      Turma 2:
a                             k
b                             l
c                             m
d                             n
e                             o
f                             p
g                             q
h                             r
i                             s
j                             t