FOR/NEXT program question

If you have questions about any aspect of QBasic programming, or would like to help fellow programmers solve their problems, check out this board!
Post Reply
JasonQuinn1992
Coder
Posts: 42
Joined: Mon Sep 03, 2012 4:32 pm

FOR/NEXT program question

Post by JasonQuinn1992 »

Im working on two homework assignments at once my next assignment is to

Use a FOR/NEXT loop to total the numbers from 1 through 100. Print the numbers on the screen.

Here is what I have so far....

DIM X AS INTEGER

CLS

FROM X = 1 TO 100
RANDOMIZE TIMER
PRINT (RND * 100);
NEXT X


The program Im having when i try to run this program is that i get an "expected end-of-statement" error on "TO". Why would this be?
User avatar
burger2227
Veteran
Posts: 2466
Joined: Mon Aug 21, 2006 12:40 am
Location: Pittsburgh, PA

Post by burger2227 »

Code: Select all

CLS 
RANDOMIZE TIMER 

FOR X = 1 TO 100 
PRINT (RND * 100); 
NEXT X 
Please acknowledge and thank members who answer your questions!
QB64 is a FREE QBasic compiler for WIN, MAC(OSX) and LINUX : https://www.qb64.org/forum/index.php
Get my Q-Basics demonstrator: https://www.dropbox.com/s/fdmgp91d6h8ps ... s.zip?dl=0
JasonQuinn1992
Coder
Posts: 42
Joined: Mon Sep 03, 2012 4:32 pm

Post by JasonQuinn1992 »

I was able to figure that out and fix it! Thanks for the help!
Post Reply