Counting to 200 than back to zero
sokin
Posts: 32
in Propeller 1
Hello, this code can count to 200, however, i need to modify it to count to 200 and then back to zero. I just can't seem to figure it out.
int main() // main function
{
for(int n = 0; n <= 200; n = n + 5) //...Count to 200
{
print("n = %d\n", n); // Display name & value of n
pause(500); // 0.5 s between reps
}
}
int main() // main function
{
for(int n = 0; n <= 200; n = n + 5) //...Count to 200
{
print("n = %d\n", n); // Display name & value of n
pause(500); // 0.5 s between reps
}
}
Comments
int main() // main function
{
for(int n = 0; n <= 200; n = n + 5) //Count to 200
{
print("n = %d\n", n); // Display name & value of n
pause(500); // 0.5 s between reps
}
for(int n = 200; n >= 0; n = n + 10) //Count to 0
{
print("n = %d\n", n); // Display name & value of n
pause(500); // 0.5 s between reps
}
}
tom
error: 'n' undeclared (first use in this function)
count to 200 by 5s.c:18:8: note: each undeclared identifier is reported only once for each function it appears in
Done. Build Failed!
Thanks for all the feed back