ksdf.net
当前位置:首页>>关于C语言编程,输入10个整数,分别按顺序和逆序输出的资料>>

C语言编程,输入10个整数,分别按顺序和逆序输出

#include #define N 10 main() { int i,a[N],t; for(i=0;i

#include int main(void) {int arr[10];int i;printf("请为数组输入10个整数:\n");for(i=0;i

#includeint main(){int a[6],i;for(i = 0;i < 6; i++){scanf("%d",&a[i]);}for(i = 5 ; i>=0;i--){printf("%d ",a[i]);}printf("\n");return 0;}

#include int reversr(int m){ int n; n=0; while(m) { n=n*10 + m%10; m=m/10; } return n;}void main(){ int m,n; scanf("%d",&m); n=reversr(m); printf("n=%d\n",n);}

#includeint main(){ int a[10]; int i; int t; for(i = 0; i < 10; i++) scanf("%d",&a[i]); for(i = 0; i < 5; i++) { t = a[i]; a[i] = a[9-i]; a[9-i] = t; } for(i = 0; i < 10; i++) printf("%d ",a[i]); printf("\n"); }

int n;scanf("%d",&n);while(n>0){ printf("%d",n%10); n=n/10;}

#includevoid fun(){ int n,n1=0; scanf("%d",&n); while(n) { n1= n1*10+n%10; n=n/10; } printf("%d\n",n1);} int main(){ fun(); return 0;}

将前5个数和后5个数镜像对调即可。代码如下: //#include "stdafx.h"//If the vc++6.0, with this line.#include "stdio.h"int main(void){ int a[10],i,j; printf("Input 10 integers...\n"); for(i=0;i

#include void main(){int i=0,j,n,a[100];scanf("%d",&n);while(n){a[i]=n%10;n/=10;i++;}for(j=0;j

网站首页 | 网站地图
All rights reserved Powered by www.ksdf.net
copyright ©right 2010-2021。
内容来自网络,如有侵犯请联系客服。zhit325@qq.com