#include<stdio.h> int main() { printf("\n\n\t\tStudytonight - Best place to learn\n\n\n"); int c, d, n, a[100], b[100]; printf("\n\nEnter number of elements in array :"); scanf("%d", &n); printf("\n\nEnter %d elements\n", n); for(c = 0; c < n; c++) scanf("%d", &a[c]); /* temporarily storing elements into array b starting from end of array a */ for(c = n-1, d = 0; c >= 0; c--, d++) b[d] = a[c]; /* copying reversed array into original. Here we are modifying original array to reverse it. */ for(c = 0; c < n; c++) a[c] = b[c]; printf("\n\n Resultant array is: "); for(c = 0; c < n; c++) printf("%d", a[c]); printf("\n\n\t\t\tCoding is Fun !\n\n\n"); return 0; }
结果
![童谣](https://2743.com/wp-content/uploads/2023/01/tongyao.png)
Linux, PHP, C,C++,JavaScript,verilog 老师
除教程外,本网站大部分文章来自互联网,如果有内容冒犯到你,请联系我们删除!