[ create a new paste ] login | about

Link: http://codepad.org/YMBKM27k    [ raw code | output | fork ]

C, pasted on Nov 18:
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
#include <stdio.h>

int main(void)
{
 int a[5]={11,12,13,14,15};
 int b[5]={21,22,23,24,25};
 int c[5];
 int i;
 int *a_p, *b_p,*c_p;
 a_p = &a[4];
 b_p = &b[4];
 c_p = &c[4];
 for(i=0; i<5; i++)
  {
   *(c_p + i - 4) = *(a_p + i - 4)+(*(b_p + i - 4));
   printf("%d と%d の和は%d\n",*(a_p + i - 4),*(b_p + i - 4),*(c_p + i - 4));
  }
 return 0;
}


Output:
1
2
3
4
5
11 と21 の和は32
12 と22 の和は34
13 と23 の和は36
14 と24 の和は38
15 と25 の和は40


Create a new paste based on this one


Comments: