answersLogoWhite

0


Best Answer

void main()

{

//variable declaration

int a;

int b;

printf("\n Enter the first value");

scanf("%d",&a);

printf("\n Enter the second value");

scanf("%d",&b);

a=a+b;

b=a-b;

a=a-b;

printf("\n After swap the value");

printf("\n value of A=%d",a);

printf("\n value of A=%d",b);

getch();

}

User Avatar

Wiki User

12y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: How do you write a program in C that variables change value with each other?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

What is constant variables?

Variables are items, which change their values during the execution of a program. Constants do not change the value during the execution of a program.


Difference between numeric constants and numeric variables in qbasic?

A constant is not supposed to change during program execution. A variable may change, in the sense that you assign a value, then another value, then another...A constant is not supposed to change during program execution. A variable may change, in the sense that you assign a value, then another value, then another...A constant is not supposed to change during program execution. A variable may change, in the sense that you assign a value, then another value, then another...A constant is not supposed to change during program execution. A variable may change, in the sense that you assign a value, then another value, then another...


What is constant and variable?

A variable is a named object that is mutable. A constant is a named object that is immutable.


What is the difference between macros and constant variable?

Macros are processed at preprocessing time where as constant variables are processed at complie time. Macros doesnot have any scope but constant variables has scope. Macros doesnot have the type checking where as constant variables have type checking.


How are constants and variables different?

Constants are values that remain constant and cannot be changed once they are assigned a value. Variables, on the other hand, can have different values assigned to them and their value can be changed throughout the program. Constants provide a fixed value, while variables provide flexibility and allow for changes in value.


What is the difference between constants and variables?

A variable is a quantity which changes its value through out the program or its lifetime. But a constant is a quantity which does not change its value through out its life time. There are 5 basic constants.


Why are function notation important?

A function is a relationship between quantities (variables) that occurs when the value of one of the quantities can be given uniquely by specified values of the other quantities. The variables involved can be either independent or dependent. The values of certain variables are fixed while others are allowed to change. The fixed variables are called the independent variables, and the dependent variables are those that change in response to the given value of the independent variable. A function therefore relates dependent variables to independent variables, the only restriction being that each value of the dependent variable is given uniquely by one, and only one, value for each of the independent variables.


What is the difference between variables and constants in java?

constant is does not change the value of during the excution of programvariable it changes the value during the excution of program


A sentence for the word independent variable?

Two variables are called independent when whatever change in one of them do not influences the value of the other.


Why are public instance variable dangerous?

Public instance variables are not dangerous, but can put your program at risk of being hacked. For instance, say the variable bacon is an integer that represents your health in a game, and its value is 50. Someone could change its value to 1,000,000 by using a program called a decompiler, then change the code, and recompile it.


What is the meaning of constant variables?

Constant variables are variables that, once initialized, do not change in value. They are effectively the same as literal constants, except that you can use symbolic names to make it easier to understand the meaning of the program. For instance, in a trigonometry program, it is easier to use the identifier PI than it is to use the literal 3.1415926535897932. Also, if you have a constant that might be adjustable, such as a factor in an equation, naming it allows you to change its value by changing only one line of code, rather than seeking out all of the lines of code that refer to the factor. Constant variables are also candidates for being placed in read-only memory, potentially making the program more secure.


What does it mean for economic variables to positively related?

if two variables are positively related,it means that the two variables change in the same direction.that is,if the value of one of the variables increases,the value of the other variable too will increase.for example,if employment as an economic variable increases in a country,and price of goods too increases then we can say that these two variables(employment and price) are positively related