2643 两数交换顺序
Time Limit : 2000/1000 MS(Java/Others) | Memory Limit : 65536/32768 KB(Java/Others)
Submits : 9201 | Solved : 5817
Description
设计函数实现两数交换顺序,在主函数中调用并验证。
Input
主函数中输入两个整数。
Output
设计函数交换两数顺序。
Sample Input
3 9
Sample Output
Before swap:x=3,y=9 After swap:x=9,y=3
Template
#include<stdio.h>
@-@
int main()
{
int x,y;
scanf("%d%d",&x,&y);
printf("Before swap:x=%d,y=%d\n",x,y);
swap(&x,&y);
printf("After swap:x=%d,y=%d\n",x,y);
return 0;
}
HINT
程序填空题,模板中@-@的位置是需要填空的部分。
Source
NBU OJ
浙公网安备 33020402000166号