...输入三个数字,将其颠倒顺序输出。例如输入:1,2,3 输出:3,2,1...
void main(){ int i,temp;int a[3];for(i=0;i<3;i++){ scanf("%d",&a[i]);} for(i=0;i<2;i++){ temp=a[i];a[i]=a[2-i];a[2-i]=temp;} for(i=0;i<3;i++){ printf("%d",a[i]);} }
c语言编程中,怎样输入一个三位数,将其各位数字反序输出,如输入321,输...
d2=num1%100\/10; \/\/十位 d3=num1%10; \/\/个位 num2=d1+d2*10+d3*100;printf("The sorted number is %d",num2);} }
c语言编程中,怎样输入一个三位数,将其各位数字反序输出,如输入321,输...
include <iostream>#include <stdio.h>#include <math.h>#include <iomanip>using namespace std;int main(){int n;cin>>n;while(n!=0){cout<<n%10;n\/=10;}cout<<endl;return 0;}
...的三位数,将其各位数字反序输出(例如输入123,输出321).
printf("%d",100*d+10*c+b);}
...的三位数,将其各位数字反序输出(例如输入123,输出321)。
include<stdio.h> include<math.h> int main(){ int i,num,n,ans,tt;while(scanf("%d",&num)!=EOF){ ans=0;n=3;\/\/如果要求N位数反转,把n改了就好了 while(n!=0){ tt=num%10;num\/=10;ans+=tt*pow((double)(10),(double)(--n));} printf("%d\\n",ans);} return 0;}...
已解决 c语言怎么写逆序数字。如123输出321
void main(){ int digits=0;\/\/位数 int i=0;long int temp;long int number;\/\/输入的数据 int a[5];\/\/存储各位 printf("Input a postive interger!\\n");scanf("%ld",&number);if((number<0)||(number>=100000)){ printf("Input Error!\\n");return;} temp=number;while(temp!=0)...
编程从键盘输入一个三位数,将它们逆序输出。如输入123,输出321.谢谢...
void main(){int x,a,b,c;cin>>x;a=x\/100;b=x\/10%10;c=x%10;cout<<c*100+b*10+a<<endl;例如:include<stdio.h> int main(){ int a,b,c,t;scanf("%d",&a);b=a%10;c=(a-b)%100;t=a\/100;printf("b=%dc=%dt=%d",b,c,t);return 0;} ...
用c语言把数字倒过来,输入123,输出321这样,大一水平,多用简单语句,复杂...
include "stdio.h"int main(int argc,char *argv[]){int n;printf("Input n(int 0<=n)...\\nn=");if(scanf("%d",&n)!=1 || n<0){printf("Input error, exit...\\n");return 0;}while(n){printf("%d",n%10);n\/=10;}printf("\\n");return 0;}运行样例:
如何用C语言输入123,输出321
程序如下:include<stdio.h> main(){ intx,b0,b1,b2,s;printf("inputx:");scanf("%d",&x);b2=x\/100;b1=(x-b2*100)\/10;b0=x%10;s=b0*100+b1*10+b2;printf("s=%d\\n",s);}
c语言 输入三个数字,反序输出这三个数字
include <cstdio>using namespace std;int main(){ int a,b,c; scanf("%d%d%d",&a,&b,&c); printf("%d %d %d\\n",c,b,a); return 0;}