XML Programming
 
Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
User Name:
Password:
Remember me

The Shed is going Social! Join us on FaceBook and Twitter and chime in on the conversation.

Go Back   Dev Shed ForumsProgramming Languages - MoreXML Programming

Reply
Add This Thread To:
  Del.icio.us   Digg   Google   Spurl   Blink   Furl   Simpy   Y! MyWeb 
Thread Tools Search this Thread Rate Thread Display Modes
 
Unread Dev Shed Forums Sponsor:
  #1  
Old May 30th, 2012, 03:28 AM
viannal viannal is offline
Registered User
Dev Shed Newbie (0 - 499 posts)
 
Join Date: May 2012
Posts: 3 viannal User rank is Just a Lowly Private (1 - 20 Reputation Level) 
Time spent in forums: 45 m 54 sec
Reputation Power: 0
BASAL Problem

Hey, all
Anybody here familiar with BASAL language?
It's said to be an "XML based programming language which is translated into other programming languages before being compiled Derives its syntax from C style languages such as Java C Flex iPhone BlackBerry Windows Mobile Palm OS Symbian Linux J2ME Android".
I'm STRUGGLING to write a program to calculate the least common multiple for two numbers in BASAL language. And the program should only consider the first twenty multiples of each number. Once the counters both exceed 20, it will show "no answer".
I know basically, a outer while loop and an inner one are needed, but I just can't make them right!
Here's what I have now. The LCM I got for 3 and 7 is 42!
Please help!

GET number1
GET number2
ASSIGN counter1 = (1)
ASSIGN counter2 = (1)
ASSIGN m1 = (number1)
ASSIGN m2 = (number2)
WHILE m1 != (m2)
BEGIN
ASSIGN m1 = (m1 * counter1)
IF counter1 < (20)
BEGIN
WHILE m2 != (m1)
BEGIN
ASSIGN m2 = (m2 * counter2)
ASSIGN counter2 = (counter2 + 1)
IF counter2 >= (20)
BEGIN
ASSIGN m2 = (m1)
ASSIGN answer = (-(1))
END
IF counter2 < (20)
BEGIN
ASSIGN answer = (m1)
END
END
IF answer != (-(1))
BEGIN
SHOW "FOUND"
SHOW answer
END
IF answer == (-(1))
BEGIN
ASSIGN m1 = (number1)
ASSIGN m2 = (number2)
ASSIGN counter1 = (counter1 + 1)
ASSIGN counter2 = (1)
END
END
IF counter1 >= (20)
BEGIN
ASSIGN m1 = (m2)
ASSIGN answer = (-(1))
SHOW "no answer"
END
END

Reply With Quote
Reply

Viewing: Dev Shed ForumsProgramming Languages - MoreXML Programming > BASAL Problem

Developer Shed Advertisers and Affiliates



Thread Tools  Search this Thread 
Search this Thread:

Advanced Search
Display Modes  Rate This Thread 
Rate This Thread:


Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

vB code is On
Smilies are On
[IMG] code is On
HTML code is Off
View Your Warnings | New Posts | Latest News | Latest Threads | Shoutbox
Forum Jump

Forums: » Register « |  User CP |  Games |  Calendar |  Members |  FAQs |  Sitemap |  Support | 
  
 


Powered by: vBulletin Version 3.0.5
Copyright ©2000 - 2013, Jelsoft Enterprises Ltd.

© 2003-2013 by Developer Shed. All rights reserved. DS Cluster - Follow our Sitemap