fork(1) download
  1. #include <stdio.h>
  2. #define MAX 6
  3.  
  4. int main(void) {
  5. int vet1[MAX];
  6. int vet2[MAX / 2];
  7. for (int i = 0; i < MAX; i++) {
  8. scanf("%d", &vet1[i]);
  9. }
  10. for (int i = 0; i < MAX / 2; i++) {
  11. vet2[i] = vet1[i * 2] + vet1[i * 2 + 1];
  12. }
  13. for (int i = 0; i < MAX / 2; i++) {
  14. printf("%d\n", vet2[i]);
  15. }
  16. }
Success #stdin #stdout 0s 2172KB
stdin
1
2
3
4
5
6
stdout
3
7
11