66问答网
所有问题
c语言输入三个数,按照从小到大顺序排列 数之间用“->”相连
如题所述
举报该问题
推荐答案 2018-11-18
#include<stdio.h>
main()
{ int a,b,c,t;
while(1){
scanf("%d%d%d",&a,&b,&c);
if(a>b){t=a;a=b;b=t;}
if(a>c){t=a;a=c;c=t;}
if(b>c){t=b;b=c;c=t;}
printf("%d->%d->%d\n\n",a,b,c);
}
}
如图所示,望采纳。。。。。。
温馨提示:答案为网友推荐,仅供参考
当前网址:
http://66.wendadaohang.com/zd/pppssnvp9DiiUDnn9s.html
其他回答
第1个回答 2018-11-18
参考代码如下:
#include<stdio.h>
int main()
{
int a,b,c,t,max,min;
scanf("%d%d%d",&a,&b,&c);
t=a+b+c;
max=a>b?a:b;
max=max>c?max:c;
min=a<b?a:b;
min=min<c?min:c;
printf("%d->%d->%d",min,t-max-min,max);
return 0;
}
追答
相似回答
C语言
如何从键盘
输入
任意
3个数,
按
从小到大
的
顺序
输出?
答:
输入3个
字符串,按
从小到大顺序
输出。 //先用程序对
三个数
进行从小到大
排序,
然后修改程序#include<stdio.h>#include<string.h>int main(){void swap(char *pt1,char *pt2); char a[20],b[20]
,c
[20]; char *p1,*p2,*p3; printf("请
输入三个
字符串:"); gets(a); gets(b); g...
C语言中
从键盘上
输入三个数,
将之
排序
后按由大到小的
顺序
输出
答:
include<stdio.h> int main(void){int a,b,c,t;printf("请
输入三个数
");scanf("%d%d%d",&a,&b,&c);if(a<b){t=a;a=b;b=t;} if(b<c){t=b;b=c;c=t;} if(a
编写
c语言
程序实现从大到小
排列三个
数值。
答:
inta,b,c,t;printf("请输入三个数:");scanf("%d%d%d",&a,&b,&c);if(a>b){ t=a;a=b;b=t;} if(a>c){ t=a;a=c;c=t;} if(b>c){ t=b;b=c;c=t;} printf("
从小到大的顺序
是:%d %d %d\n",a,b,c);return0;} ...
c语言
编程的题 “从键盘
输入3个数,
使其按
从小到大
的
顺序排列
输出...
答:
include<stdio.h> void sort(int &a,int &b)//对两个
数进行排序
{ int d;if(a>b){ d=a;a=b;b=d;} } void main(){ int a,b
,c,
d;printf("
输入三个数
");scanf("%d%d%d",&a,&b
,&c
);sort(a,b);sort(a,c);sort(b,c);printf("%d %d %d",a,b,c);} ...
C语言
一千以内回文数+
输入三个数从小到大排序
?
答:
下面是
C语言
实现一千以内回文数和
输入三个数从小到大排序
的程序:include <stdio.h> // 判断是否为回文数 int isPalindrome(int num) { int n = num, rev = 0;while (n > 0) { rev = rev * 10 + n % 10;n /= 10;} return (num == rev);} // 从小到大排序 void sort(int ...
C语言
编程题
,输入三个
整数,按从大到小的
顺序
输出
答:
int a,b
,c,
t;printf("请
输入三个
整数:\n");scanf("%d,%d,%d",&a,&b
,&c
);if(a<b){//完成a和b值的交换,a里面放最大值 t=a;a=b;b=t;} if(a<c){//完成a和c值的交换,a里面放最大值 t=a;a=c
;c
=t;} if(b<c){//完成b和c值的交换,a里面放最大值 t=b;b=c;c...
大家正在搜
c语言输入三个数,按从小到大输出
c语言输入3个数从大到小输出
三个数从小到大排序C语言
c语言10个数从小到大排序
c语言按从小到大的顺序输出
c语言三个数大小排序
c语言从小到大排序
c语言字母从小到大排序
三个数排序c语言程序