-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathlab8b3.c
More file actions
46 lines (42 loc) · 1018 Bytes
/
lab8b3.c
File metadata and controls
46 lines (42 loc) · 1018 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
#include<stdio.h>
int main()
{
int a[5], b[5];
int *pa =a;
int *pb = b;
printf("nhap gia tri cho 2 mang:\n");
for(int i =0; i<5;i++){
printf("nhap gia tri thu %d cua mang a: ",i);
scanf("%d", pa+i);
}
// printf("%d",*(pa+i));
printf("\n======================== \n");
for(int i =0; i<5;i++){
printf("nhap gia tri thu %d cua mang b: ",i);
scanf("%d", pb+i);
}
int c[5];
int *pc = c;
for(int i =0; i<5;i++)
{
*(pc + i) = *(pa+i)+*(pb+i);
}
printf("mag a: ");
for(int i=0;i<5;i++)
{
printf("%d ",*(pa+i));
}
printf("\n");
printf("mag b: ");
for(int i=0;i<5;i++)
{
printf("%d ",*(pb+i));
}
printf("\n");
printf("mang c: ");
for(int i=0;i<5;i++)
{
printf("%d ",*(pc+i));
}
return 0;
}