# Thread: Help solving a question

1. ## Help solving a question

Hi all,
my professor gave me some questions to solve and i cant even understand what the questions wants although it looks very simple, if anyone can help me i will be grateful,

here are the questions:

1-Write a program that estimates the of integer numbers 1 to N,your program should read the integer number N and be sure N>5.

2-Write a program to read number n using keyboard where n must be >2.Then program display the multiplication table n rows, n columns and table's entity is i x j.where i=1,2,...n,
j=1,2,...n.
Display each table in a new horizontal line.

thanks.

2. What are you stuck on? For the second, you'll need a pair of loops. For the first, you don't really need to estimate, because there's a formula to calculate that.

Quzah.

3. can u tell me what the loops are ?

4. A loop is a method of repeating a block of code for a controlled number of times. There are three easy ways to do this:
Code:
```for( initializer; condition; increment )
{
...stuff to do...
}```
Example:
Code:
```int x;
for( x = 0; x < 5; x++ )
{
...stuff to do...
}```
This says, start x at zero, and while x is less than five, increment x once at the end of each loop pass. There is also:
Code:
```while( condition )
{
...do stuff...
}```
And:
Code:
```do
{
...do stuff...
} while( condition );```
The difference here is that the condition may evaluate false, on the first one, at the first check, and the loop may not execute, whereas with a do-while, the loop is guaranteed to execute at least once before it checks the condition.

Quzah.

5. Originally Posted by everyone0
Hi all,
my professor gave me some questions to solve and i cant even understand what the questions wants although it looks very simple, if anyone can help me i will be grateful,

here are the questions:

1-Write a program that estimates the of integer numbers 1 to N,your program should read the integer number N and be sure N>5.

2-Write a program to read number n using keyboard where n must be >2.Then program display the multiplication table n rows, n columns and table's entity is i x j.where i=1,2,...n,
j=1,2,...n.
Display each table in a new horizontal line.

thanks.

Don't worry, I don't understand the question either. That's because it makes no sense at all.

Did your professor give it to you like this? If so, he should be banned from every teaching again. Did you translate it? Then do a better job translating it. Did you write it in your own words? Then, damn, you have no idea what you're typing .

6. My guess is that "estimates" is really "sums". As for the second one, that's pretty clear.

Quzah.

7. Code:
```/* ESTIMATES the sum of integer 1 through n :) */
int SumOneTo(int n)
{
return n/2 + n/2 * n+2;
}```

8. Originally Posted by NeonBlack
Code:
```/* ESTIMATES the sum of integer 1 through n :) */
int SumOneTo(int n)
{
return n/2 + n/2 * n+2;
}```
Isn't it actually (n*(n+1))/2 ?

9. That's why it's an estimate.

10. thanks guys appreciate ur help and no i didnt translate it , the professor gave it to me like this lol