需要交换功能 [英] Need swap function

查看:92
本文介绍了需要交换功能的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

如何交换不带临时变量的2个数字?



我怎样才能互换任何2个数字????
不带任何变量??????
请回答我的问题

How do I swap 2 numbers without temp variable?



how can i interchang any 2 numbers????
with out taking any variable?????
plz ans me its urjent

推荐答案

在网络上发布时,请遵循以下规则
1.不要乞求解决方案.没有人会调查您的问题
2.不要声称它是紧急的.它只对您紧急,对我们不紧急.没有人会放弃他们手上的东西而跳来帮助您.
3.不要期望别人会做你的工作.显示您已完成的工作,当您遇到困难时寻求帮助.人们会更愿意接受您的问题.
Please follow the following rules when you post on the web
1. Don''t beg for solution. No one will look into your problem
2. Don''t claim it is Urgent. It is only urgent to you, not us. No one will drop what is on their hand and jump to help you.
3. Don''t expect people to do your job. Show sufficent work you have done then ask for help when you get stuck on something. People will be more receptive to your question.


尝试一下:
Try this:
a = a+b  // a = 5, b=10     

b = a-b  // 15-10=5  

a = a-b  // 15-5=10


这篇关于需要交换功能的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆