# Thread: Looping Problem case 3

1. ## Looping Problem case 3

ok first of all, i hoping this readable,
Code:
```
int main()
{
int x;
int y;
int n;
int holdin;
int result=0;
printf("First Value =");
scanf("%d",&x);
printf("Divide Value =");
scanf("%d",&y);
printf("Looping Times =");
scanf("%d",&n);

for(int m=1;m<n;m=m+1){

holdin=x+(m-1)*y;
result=result+holdin;
printf("%d+",holdin);

}

holdin=x+(m-1)*y;
result=result+holdin;
printf("%d=%d",holdin,result);
}```
wrong at this line after the curly brackets,
Code:
`holdin=x+(m-1)*y;`
it says '-fpermissive' again like the older thread with loop problem that i began to with the loop problems,
the reason i am adding the new line after curly brackets it because

if the loop times was 5
it only count up 4 times because
Code:
`for(int m=1;m<n;m=m+1)`
int m=1 not 0 and the increment only 4 times with the final result m=5
but when i adding the line, "-fpermissive" thing comes up,
any ideas?

2. Originally Posted by loserone+_+
ok first of all, i hoping this readable,
No, it's still a mess. You really have to work on your coding style.

Originally Posted by loserone+_+
it says '-fpermissive' again like the older thread with loop problem that i began to with the loop problems,
Copy'n'paste the full warning/error. Don't paraphrase it.
And if the problem is connected to another thread, why do you open a new one?

Code:
```for(int m=1;m<n;m=m+1)
{
holdin=x+(m-1)*y;
result=result+holdin;
printf("%d+",holdin);
}
holdin=x+(m-1)*y;```
You are declaring 'm' in the initialization part of the for-loop (a C99 feature), thus it's only visible within the body of the for-loop.
Since 'm' is not declared outside of the for-loop, you get the error/warning from the compiler.

Bye, Andreas

3. No, it's still a mess. You really have to work on your coding style.
lol maybe i need a practice for the indentation

Since 'm' is not declared outside of the for-loop, you get the error/warning from the compiler.
simple way i cant using the 'm' variable after the for loop right.
and that makes me thinking variable on "for loop" was only used once,

And if the problem is connected to another thread, why do you open a new one?
i dont think thats the same from my first thread until u say about i cant used the variable on "for loop" again,
i believe that's the same problem.
sorry for double post the problem,
this case is closed

4. Originally Posted by loserone+_+
simple way i cant using the 'm' variable after the for loop right.
You can use 'm' after the for loop if you declare it outside the for-loop.

Bye, Andreas