answersLogoWhite

0


Best Answer

It is not possible to answer this question without knowing the actual expression used in the assignment statement. The following are merely example expressions showing some of the values that could be assigned to ans:

int ans, p=100, q=50;

ans = p + q; // ans = 150

ans = p * q; // ans = 5000

ans = p - q; // ans = -50

ans = p / q; // ans = 2

ans = p % q; // ans = 0

User Avatar

Wiki User

7y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: What value is assigned to the type int variable ans in this statement if the value of p is 100 and q is 50?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

How do you use define in C?

Just type declare then the variable that you desire to assigned a certain constant value on it. Just type declare then the variable that you desire to assigned a certain constant value on it.


What value is assigned to extern variable?

Default initial value of extern integral type variable is zero otherwise null.


When function returns a value the entire function call can be assigned a variable?

AnswerYes, it can. For instance, if your function returns double you can assign the function call to a variable of type double.AnswerNo, only the returned value, of course.


What is void pointer variable?

A void pointer variable is a pointer variable (of some type) that is assigned the value zero, meaning it points to address zero. Memory address zero is a reserved address, which means the pointer variable references nothing in particular.


How do you give values to variable?

it depend on the programming language u use. for instance in c, just decalre the variable and equal it to the value it is to take. eg. my_age=21; /*my_age is the decared variable and 21 is the assigned value*/ //for php $my_age=21; /*my_age is the decared variable and 21 is the assigned value*/ for strings (in php)eg. $my_age="none of ur business" /*$my_age is the variable and the string "none of ur business" is the assigned value*/


Can you add a variable with a number?

Yes, IF the variable has been declared, has a value, and is of a numerical type such that your addition operator can perform the operation on the number and the value of that type variable. The compiler or interpreter will look up the variable's value, substitute it for the variable, and perform the addition just as if your statement used two numbers. First example: If your number is an integer and your variable is of type real, almost any addition operator can successfully add the two. Second example: If your number is a real and your variable is a character type (with a value, say, of "Smith"), the addition will obviously fail. In many languages, however, variables of type Boolean may be handled arithmetically, as the value True equals 1 and False is zero.


What type of value can be assigned to a value of interface type?

An interface doesn't have instances!


Can an float value be assigned to int variable?

Yes, an integer can be assigned as a float value.But it get stored as a float value, that is an implicit type conversion occurs during compilation.Smaller data types are convertible to larger data types.eg:float b=12;// an integer constant is assigned to a float variableprintf("%f",b);// when printing b it will print as 12.000000


How close the measured value is the the accepted value?

This value is variable, for each type of measurement.


What is the difference between data and variable?

data type refers to the kind of value that is held by a particular variable. For ex: an int variable contains integer value, a string holds a alpha numeric value etc. variable refers to the name of a value using which we can refer to this value. Ex: public int age = 28; here int is the data type and age is the variable.


What is the use of variables in c language?

Variable is of any Data Type and Data Type can be defined as a type of value that a Variable will hold.............means which type of value you want to store, eg: fractional value (3.5454), whole value (3,76,3,67), character value (a,v,c,f,b,z) etc.......... So The Use the Variable is to store a value of any kind (some mentioned above)


What is the difference between value type parameters and reference type parameters?

When a variable is passed by value, the function receives a copy of the variable. When a variable is passed by reference, the function receives a reference, or pointer, to the original data.