Evening all,
looking to make a counting loop , and wanting some advice please
i am familiar with the following example:
FOR N = 0 TO 10 STEP 1
PRINT N
NEXT N
which will print 1,2,3, etc
It has been so long since i have done any programming,
i am looking for an example
i believe it's
for . . .
end if
i'm a bit lost if somebody can point me in the right direction please
steve
loops using "FOR"
- JohnCrow
- Valued Contributor
- Posts: 1367
- Joined: Wed Sep 19, 2007 1:21 pm
- Location: Lincolnshire
- Has thanked: 364 times
- Been thanked: 716 times
- Contact:
Re: loops using "FOR"
Hi Steve
Its a long time since I did any C programming, Id realy like to get back into it.
If I remember to leave a "FOR" loop the command is "RETURN"
This is a simple example from a C programming book ive got on the shelf
#include <stdio.h>
main()
{
int ctr; /* set variable ctr as integer */
for (ctr = 1; ctr<=10; ctr++) /*start ctr at 1 and increment through loop */
{ printf ("%d \n", ctr) ; } ? * Body Of Loop */
return;
}
Program will print 1 2 3 4 5 6 7 8 9 10 (in a vertical line)
Im sure the guys at Matrix will give you a better answer when they come in.
Hope this is a help
Its a long time since I did any C programming, Id realy like to get back into it.
If I remember to leave a "FOR" loop the command is "RETURN"
This is a simple example from a C programming book ive got on the shelf
#include <stdio.h>
main()
{
int ctr; /* set variable ctr as integer */
for (ctr = 1; ctr<=10; ctr++) /*start ctr at 1 and increment through loop */
{ printf ("%d \n", ctr) ; } ? * Body Of Loop */
return;
}
Program will print 1 2 3 4 5 6 7 8 9 10 (in a vertical line)
Im sure the guys at Matrix will give you a better answer when they come in.
Hope this is a help
1 in 10 people understand binary, the other one doesn't !
- Steve001
- Valued Contributor
- Posts: 1189
- Joined: Wed Dec 31, 2008 3:37 pm
- Has thanked: 460 times
- Been thanked: 523 times
- Contact:
Re: loops using "FOR"
thanks for that , will have a go
steve
steve
Success always occurs in private and failure in full view.