URI Online Judge Solution 1175 Array change I Using C, Python Programming Language.
Write a program that reads an array N [20]. After, change the first element by the last, the second element by the last but one, etc.., Up to change the 10th to the 11th. print the modified array.
Input
The input contains 20 integer numbers, positive or negative.
Output
For each position of the array N print "N[i] = Y", where i is the array position and Y is the number stored in that position.
Input Sample | Output Sample |
0 | N[0] = 230 |
Solution Using C:
#include <stdio.h>
int main() {
int i,n[20],j=20;
for(i=0; i<20; i++)
{
scanf("%d",&n[i]);
}
for(i=0; i<20; i++)
{
--j;
printf("N[%d] = %d\n",i,n[j]);
}
return 0;
}
Comments
Post a Comment