Click here to Skip to main content
15,886,708 members
Please Sign up or sign in to vote.
1.00/5 (1 vote)
See more:
C#
How do i Write a program to display a=333,b=222,c=111 if a=111,b=333,c=222 without declare any extra memory?


What does without declaring any extra memory means ?

What I have tried:

I was thinking of swapping the numbers but i dont think it is the correct solution
Posted
Updated 25-Jul-16 22:52pm

Just an hint:
Displaying "a=333" don't mean to store 333 in the variable a.
if you know how to display some text followed with a value, you are done, test is "a=" and value is 333 (or what is in b variable)

look a cout or printf
 
Share this answer
 
v3
ok i got it.

Logic:

a= a+b+c
b=a-b-c
c=a-b-c
a=a-b-c
 
Share this answer
 
Comments
Patrice T 26-Jul-16 6:40am    
You are not requested to store new values in a,b,c.
You are just requested to display 3 lines containing some text followed by a value. At display, there is no link between the text and the value.

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900