Untitled

mail@pastecode.io avatar
unknown
plain_text
2 years ago
846 B
1
Indexable
Never
#include <stdio.h>
#define SIZE 5

int main() {
    int test1[SIZE], test2[SIZE], total[SIZE], i, j;
    int *test1Ptr = test1, *test2Ptr = test2, *totalPtr = total;
    
    printf("The format of entering marks:.\n");
    printf("[test 1 marks] [test 2 marks]\n");
    printf("It must be done 5 times.\n");
 
    for(i=0; i<SIZE; i++) {
      printf("Enter Test 1 and Test 2 marks : ");
      scanf("%d %d",(test1Ptr + i),(test2Ptr + i));
      *(totalPtr + i) = *(test1Ptr + i) + *(test2Ptr + i);
    }
    
    printf("\nThe arrays for each pair:\n\n");
    
    for(j=0;j<SIZE;j++) {
      printf("Test1[%d] = %d Test2[%d] = %d\n",j,*(test1Ptr + j),j,*(test2Ptr + j));
    }
    
    printf("\nThe total:\n\n");
    
    for(i=0;i<SIZE;i++) {
      printf("Total[%d] = %d\n",i,*(totalPtr + i));
    }
 return 0;
}