#include<stdio.h>
#include<stdlib.h>
void main()
{
int i,n;
//The number of elements in each array is taken from test case data
scanf("%d", &n);
#include<stdlib.h>
void main()
{
int i,n;
//The number of elements in each array is taken from test case data
scanf("%d", &n);
int *a,*b,*c;
a=(int*)malloc(n*sizeof(int));
for(int i=0;i<n;i++)
scanf("%d",a+i);
b=(int*)malloc(n*sizeof(int));
c=(int*)malloc(n*sizeof(int));
for(int i=0;i<n;i++)
scanf("%d",b+i);
for(int i=0;i<n;i++)
*(c+i)=*(a+i)+*(b+i);
printf("Result is\n");
for(i=0; i<n; i++)
{
printf("%d\n",*(c+i));
}
}
Input | Output | |
Test Case 1 | 5 10 20 30 40 50 1 2 3 4 5 | Result is 11 22 33 44 55 |
Test Case 2 | 4 100 200 300 400 400 300 200 100 | Result is 500 500 500 500 |
No comments:
Post a Comment