I am not getting the codes to swap twp numbers using a third variable.as i am a beginner.PLEASE HELP ME
anurag09
0
Newbie Poster
Recommended Answers
Jump to PostPerhaps if you indicated which language you are working in, this thread could be moved to the proper forum where someone may be able to assist you.
Jump to Postint temp; int a = 1; int b = 2; // swap a and b temp = a; a = b; b = temp;
Jump to PostPerhaps a little late, but since it is not marked as solved I will give it a go. In order to swap two variables, denoted 'a' and 'b', using a third variable, denoted 'temp', you need to do the following:
1. place one of the numbers, say the one inside …
All 11 Replies
Ezzaral
2,714
Posting Sage
Team Colleague
Featured Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
Momerath
1,327
Nearly a Senior Poster
Featured Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
apines
116
Practically a Master Poster
Featured Poster
ddanbe
commented:
Nice :)
+8
Anuradha Mandal
-28
Junior Poster
Ancient Dragon
5,243
Achieved Level 70
Team Colleague
Featured Poster
apines
116
Practically a Master Poster
Featured Poster
apines
116
Practically a Master Poster
Featured Poster
geojia
0
Junior Poster in Training
Momerath
1,327
Nearly a Senior Poster
Featured Poster
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.