> 其他 >
输入3个整数a,b,c编程交换它们的值,即把a的值给b,把b中的值给c,把c中的值给a. 用c语言编程 求解
人气:266 ℃ 时间:2020-06-17 14:23:36
解答
#include "stdio.h"
int main (){
int a, b, c, temp;
printf("请输入三个整数:\n");
scanf("%d%d%d",&a,&b,&c);
printf("输入为%d,%d,%d\n",a,b,c);
temp=a;
a=b;
b=c;
c=temp;
printf("交换后为%d,%d,%d\n",a,b,c);
return 0;
}
推荐
猜你喜欢
© 2024 79432.Com All Rights Reserved.
电脑版|手机版