Topic is
Arbitrary input ten integer element in the array, a calculated and the two adjacent elements in a, and the existence and the array b, according to the three elements in each row in the form of output,
CodePudding user response:
Reference:
# include Int main () { Int a [10]={0}, [5] b={0}, I, j; for(i=0; i<10; I++) The scanf (" % d ", & amp; A [I]); For (I=0, j=0; i<10; I +=2, j++) B=a [I] + [j] a [I + 1); for(j=0; j<5; J++) { Printf (" % 3 d, b [j]); If ((j + 1) % 3==0 | | (j + 1)==5) printf (" \ n "); } return 0; } CodePudding user response:
B [5] [9] should be changed to b
CodePudding user response:
reference 1st floor QZJHJXJ response: for reference: # include Int main () { Int a [10]={0}, [5] b={0}, I, j; for(i=0; i<10; I++) The scanf (" % d ", & amp; A [I]); For (I=0, j=0; i<10; I +=2, j++) B=a [I] + [j] a [I + 1); for(j=0; j<5; J++) { Printf (" % 3 d, b [j]); If ((j + 1) % 3==0 | | (j + 1)==5) printf (" \ n "); } return 0; } for (I=0, j=0; i<10; I +=2, j++) B=a [I] + [j] a [I + 1);//this place should be crossed, when I=9, I + 1 is 10 CodePudding user response:
# include # define SIZE 10 Int main () { Int a [SIZE], [SIZE] b={0}; int i, j; for(i=0; i The scanf (" % d ", & amp; A [I]); For (I=0, j=0; i B=a [I] + [j++] a [I + 1); } For (I=0; I & lt; j; I++) Printf (" % d % c, b [I], (I + 1) % 3? "' : '\ n'); /* For (I=0, j=0; i<10; I +=2, j++) B=a [I] + [j] a [I + 1); for(j=0; j<5; J++) { Printf (" % 3 d, b [j]); If ((j + 1) % 3==0 | | (j + 1)==5) printf (" \ n "); } */ return 0; } For your reference ~ Adjacent to the sum of two elements, such as 0 1 2 3 4 5 6 7 8 9, understanding of the building Lord is 0, 1, 2, 3, and so on, my understanding is 0, 1, 1, 2, 2, 3, and so on such a group, it is also called the two adjacent elements CodePudding user response:
reference 3 building self-confidence boy reply: Quote: refer to 1st floor QZJHJXJ response: for reference: # include Int main () { Int a [10]={0}, [5] b={0}, I, j; for(i=0; i<10; I++) The scanf (" % d ", & amp; A [I]); For (I=0, j=0; i<10; I +=2, j++) B=a [I] + [j] a [I + 1); for(j=0; j<5; J++) { Printf (" % 3 d, b [j]); If ((j + 1) % 3==0 | | (j + 1)==5) printf (" \ n "); } return 0; } for (I=0, j=0; i<10; I +=2, j++) B=a [I] + [j] a [I + 1);//this place should be crossed, when I=9, I + 1 is 10 there will be no 9, I=I + 2, 8 to jump out, CodePudding user response:
reference 5 floor QZJHJXJ reply: Quote: refer to the third floor confident boy reply: Quote: refer to 1st floor QZJHJXJ response: for reference: # include Int main () { Int a [10]={0}, [5] b={0}, I, j; for(i=0; i<10; I++) The scanf (" % d ", & amp; A [I]); For (I=0, j=0; i<10; I +=2, j++) B=a [I] + [j] a [I + 1); for(j=0; j<5; J++) { Printf (" % 3 d, b [j]); If ((j + 1) % 3==0 | | (j + 1)==5) printf (" \ n "); } return 0; } for (I=0, j=0; i<10; I +=2, j++) B=a [I] + [j] a [I + 1);//this place should be crossed, when I=9, I + 1 is 10 there will be no 9, I=I + 2, 8 to jump out, Indeed, not, didn't see you I +=2, the adjacent elements, divided on understand ~ CodePudding user response:
reference 6 building self-confidence boy reply: Quote: refer to the fifth floor QZJHJXJ reply: Quote: refer to the third floor confident boy reply: Quote: refer to 1st floor QZJHJXJ response: for reference: # include Int main () { Int a [10]={0}, [5] b={0}, I, j; for(i=0; i<10; I++) The scanf (" % d ", & amp; A [I]); For (I=0, j=0; i<10; I +=2, j++) B=a [I] + [j] a [I + 1); for(j=0; j<5; J++) { Printf (" % 3 d, b [j]); If ((j + 1) % 3==0 | | (j + 1)==5) printf (" \ n "); } return 0; } for (I=0, j=0; i<10; I +=2, j++) B=a [I] + [j] a [I + 1);//this place should be crossed, when I=9, I + 1 is 10 there will be no 9, I=I + 2, 8 to jump out, Indeed, not, didn't see you I +=2, divided on the adjacent elements, understand ~ idea of the building Lord