# Thread: Need little help {newbie)

1. ## Need little help {newbie)

a)assigne the sum of x and y to z and increment the value of x by 1 after calculation
b)Test if the value of the varaible count is greater then 10.if it is ,print ”count is greater then 10”.
c)Decrement the varable x by 1 then subtract it from the varable total
d)Calculate the remainder after q is divided by divisor and assign the result to q,Write this statement in two different ways.

These are some question with which i need some help , about the part (b) it will be done just comparing the value of variable with 10 and if its greater then i should just print it rite?

2. Originally Posted by Ahmed29
a)assigne the sum of x and y to z and increment the value of x by 1 after calculation
b)Test if the value of the varaible count is greater then 10.if it is ,print ”count is greater then 10”.
c)Decrement the varable x by 1 then subtract it from the varable total
d)Calculate the remainder after q is divided by divisor and assign the result to q,Write this statement in two different ways.

These are some question with which i need some help , about the part (b) it will be done just comparing the value of variable with 10 and if its greater then i should just print it rite?
It's correct, though you're just paraphrasing the question. What exactly are you having trouble with?

QuantumPete

3. if u can code the other 3 parts i am having problem with cause i cant seem to write them

4. Originally Posted by Ahmed29
if u can code the other 3 parts i am having problem with cause i cant seem to write them
are you a newbi programmer ? or you have difficulties understand what the question is about , and what are the requirments by the question?!

5. Originally Posted by Ahmed29
a)assigne the sum of x and y to z and increment the value of x by 1 after calculation
b)Test if the value of the varaible count is greater then 10.if it is ,print ”count is greater then 10”.
c)Decrement the varable x by 1 then subtract it from the varable total
d)Calculate the remainder after q is divided by divisor and assign the result to q,Write this statement in two different ways.
A: You should have 3 integers named x, y and z. Basically you need to add the x and y integers together and assign them to the integer variable z in a statement, then after that statement increase the integer x by 1. You would do this using the addition operator (+). An example would be (Not exactly the same, you need to do SOME of the work lol, just a helper):

Code:
```int a = 2;
int b = 4;
int c = 0;

c = a * b;
a++; // ++ is short for a = a + 1;```
B: You were correct with this one, you would do an if statement to check the value of the variable count like so:

Code:
```if (count > a number) {
do something
}```
C: Decrement means to subtract 1 off the current value. It's the opposite of the ++ operator. An example:

[code]
y--; // this is short for y = y - 1;
total -= y; // this is short for total = total - y;

Q: Basically it wants you to use the modulus operator (&#37. This is used for getting the remainder of a number. It then wants you to assign the results to the variable q, and write it in two different ways. You can use a short hand way (like the ones I've been using) and the long hand way (like the ones in the comments), an example of modulus:

Code:
`int remainder = number % 2; // remainder is now equal to the remainder of number divided by 2`
NOTE: You may want to cast a variable you're using with modulus into a double for a more accurate result.

6. Do not hand out solutions to newbies. It will teach them nothing.

7. Ok I have made three programs tell me if I am wrong with any (:

Code:
```int main()
{
int x,y,z;
clrscr();
cout<<"\n Enter Value of x : ";
cin>>x;
cout<<"\n Enter Value of y : ";
cin>>y;
z=x+y;
cout<<"\n Sum : "<<z;
x=x+1;
cout<<"\n Increment : "<<x;
getch();
return 0;
}```
Code:
```int main()
{
int vcount;
cout<<"\n Enter Value : ";
cin>>cvount;
if(vcount<10)
cout<<"\n count is greater then 10 ";
else
cout<<"\n End ";
getch();
}```

Code:
```int main()
{
int x,sub;
clrscr();
cout<<"\n Enter Value of x : ";
cin>>x;
x=x-1;
cout<<"\n decrement : "<<x;
{
sub=x-(x-1);
cout<<"\n Sub from variable total : "<<sub;
}
getch();
return 0;
}```
And I really dont understand the last one, someone please explain it in detail..