Also how do you write this in C-language:
Increment the value of variable x.
Decrement the value of variable y
Compare the value of variable x and y for equality
Write this n C-language? Multiply value of variable x by value of variable y %26amp; store result n variable z?
z = x * y
++X or X++ (dependant upon the requirement)
--y or y-- (dependant upon the requirement)
x == y (you would want to store the resulting boolean value in a bool type variable)
Reply:i don't now what you really want.
but there is too many choise to do it and
if you wish use the value of the variable while that one is decrement or increment you need use a bucle, but first let me show how its work:
increment any varible in one :
x++ or ++x;
each one have diferent result. for example :
if the value of the variable x is 5 and we are using x++ begin of:
x++;
d=x+3;
d=9;
but if you use ++x;
++x;
d=x+3;
d=8;
so, when you use ++ before of any variable first use the value of the variable and the, it'll increment that varible, and when you use ++ after of any variable first increment the variable in one and them do the operations with.
its the same when you use -- to decrement a variable.
them than ones (++/---) is usually used in a bucle (for/while/dowhile), cause is more workfull there, so to compare a variable in c. must use the operator == that means equals. for example:
a==b// if a=3 and b=3 the result will be true.
Reply:hi. im 15 years old , and i have been programming for 4 years and i think i can prob help :)
x++ // this increments the variable x.
y-- // this decrements the variable y.
if(x == y)
{
// they are equal!
}
else
{
// they are not equal!
}
Reply:i dont know C, so if you want a direct answer,
i have no idea.
but most mathmatical functions in scripting
languages are fairly similar.
in javascript, it would be:
var xValue = [x input here]
var yValue = [y input here]
var Z = (xValue*yValue);
i dont know if it would look any similar to that,
but i hope it helps sorta.
/.
bouquet
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment