There's no such thing as a stupid question, but they're the easiest to answer.
JoinTour
Login
Search
 
Tag Cloud
audio bios blue screen boot bsod computer connection crash dcom dell driver drivers email error excel firefox google hard drive hardware hijackthis internet laptop logon logs off macro malware microsoft motherboard network networking problem ram recovery router screen slow software sound trojan usb userinit.exe virus vista webcam wifi windows windows 7 windows 7 64 bit windows xp wireless
Search
Search for:
Tech Support Guy Forums > Software & Hardware > Software Development >
How to write an algorithm?

Tip: Click here to scan for System Errors and Optimize PC performance
[ Sponsored Link ]

Closed Thread
 
Thread Tools
jnwk888hwq's Avatar
Junior Member with 2 posts.
 
Join Date: Jul 2003
27-Jul-2003, 12:58 PM #1
How to write an algorithm?
Do anyone here know how to write an algorithm? Please show me some basic? I'm quite new to it as I'm learning computing.

How to write an algorithm that finds the smaller of two numbers a and b? Can anyone enlighten me?

Thanks

Regards

Last edited by jnwk888hwq : 27-Jul-2003 01:07 PM.
Corrosive's Avatar
Senior Member with 1,074 posts.
 
Join Date: Jan 2003
Location: Scotland
27-Jul-2003, 02:40 PM #2
An algorithm is just another name for a program. What programming language are you using?

A basic way of doing this in, erm, BASIC, goes something like this:

let a=1
let b=2
let total=a+b
print total
end

The first line puts the number 1 into a variable named "a." Likewise, the second line puts the number 2 into "b." the third adds them together and puts the total (which is 3, obviously) into the cryptically named "total" variable. Line 4 then displays whatever is stored in "total" (3) on screen, and the last ends the program.
__________________
"Computer games don't affect kids - I mean, if Pacman affected us as kids, we'd all be running around in darkened rooms, munching magic pills and listening to repetitive electronic music."
- Kristian Wilson [Nintendo Executive 1989]

Anyone fancy going out clubbing tonight?
dtech10's Avatar
Member with 55 posts.
 
Join Date: Jan 2003
28-Jul-2003, 10:42 AM #3
How to write an algorithm?
let a=10
let b=15
let lowest=0

if a<b
lowest=a
else
lowest=b
endif
print "lowest=",lowest
Closed Thread Bookmark and Share   techguy.org/150371

THIS THREAD HAS EXPIRED.
Are you having the same problem? We have volunteers ready to answer your question, but first you'll have to join for free. Need help getting started? Check out our Welcome Guide.

Smart Search

Find your solution!



Currently Active Users Viewing This Thread: 1 (0 members and 1 guests)
 
WELCOME TO TECH SUPPORT GUY! Are you looking for the solution to your computer problem? Join our site today to ask your question -- for free! Our site is run completely by volunteers who want to help you solve your computer problems. See our Welcome Guide to get started.

Thread Tools


You Are Using:
Server ID
Advertisements do not imply our endorsement of that product or service.
All times are GMT -5. The time now is 02:24 PM.
Copyright © 1996 - 2010 TechGuy, Inc. All rights reserved.
Powered by vBulletin, Copyright © 2000 - 2010, Jelsoft Enterprises Ltd.
Powered by Cermak Technologies, Inc.