Back to: COMPUTER SCIENCE SS2
Welcome to Class !!
We are eager to have you join us !!
In today’s Computer Science class, We will be learning about BASIC Programming. We hope you enjoy the class!
Basic Function
A function is a structure that simplifies a complex operation into a single step. A function is, therefore, a many-to-one (or sometimes one-to-one) relation. The set of values at which a function is defined is called its domain, while the set of values that the function can produce is called its range. Functions act like ‘black boxes’, they accept input, value or values and process them in a defined manner to produce or return an output value. As long as you know how and when to use a particular function, you need not be bothered about how it actually works.
Consider, for example, the process of taking the square root of a number value. If you have to define this program, anytime you need a square root, your program would require extra code and you would probably get tired of entering the same code over and over again.
True Basic has a built-in function that compresses the entire square root operation into a single step. Using the SQR function, your program can easily find the square root of any number greater than or equal to zero.
BASIC Programming
In 1964, John G. Kemeny and Thomas E. Kurtz designed the original BASIC language at Dartmouth College in New Hampshire.
B – Beginners
A – All-purpose
S – Symbolic
I – Instructional
C – Code
Basic Arithmetic Expressions
Basic arithmetic expressions and algebraic expressions are similar to little different examples of basic arithmetic expressions. Arithmetic expressions are composed of a combination of constants, variables, operation symbols, and functions. An expression may be very simple or quite complex, but it will result in a single value. Whether an expression is simple or complex, the calculations must be performed in a specific order. To ensure the computer will correctly evaluate and calculate arithmetic expressions, you have to learn to code them using the rules of BASIC. To use arithmetic expressions efficiently, you must be able to evaluate and convert conventional mathematical expressions into proper BASIC expressions.
I = {P*R*T}/100
Basic arithmetic expressions and their algebraic expressions
ALGEBRAIC EXPRESSION | BASIC ARITHMETIC EXPRESSION |
B + D | B + D |
A – B | A – B |
B
C |
B / C |
D2 | D ᶺ2 |
C + B÷D | C + B/ D |
B = B x H | B = B * D |
P = ax – bx + c/2 | P = a*x – b*x + c/2 |
a(b-d)3 ÷ d+1 | a* {b-d}3/d+1 |
B = (-a+b) ÷ 2a | B = {-a+b}/2*a |
b2 – 5bc -3b | SQR {b} ᶺ c -5* b* – 3b |
(b +c) +d ÷ Sin b | {b+c} + d/Sin {b} |
Sign | Arithmetic Expression | Basic Expression | Name |
{ } | 14 + 2 | {14 + 2} | Bracket |
Of | ½ of 5 | 5 * 2 | Exponential |
/ | 24 ÷ 4 | 24/4 | Division |
x | 6 x 5 | 6 * 5 | Multiplication |
+ | 2 + 3 | 2 + 3 | Addition |
– | 3 – 2 | 3 – 2 | Subtraction |
√ | √16 | SQR {16} | Square root |
We have come to the end of this class. We do hope you enjoyed the class?
Should you have any further question, feel free to ask in the comment section below and trust us to respond as soon as possible.
In our next class, we will continue learning about programming in BASIC. We are very much eager to meet you there.
School Owner? Looking for ready-made content and tools to save time and grow easily? Book a free demo session now
Get more class notes, videos, homework help, exam practice on Android [DOWNLOAD]
Get more class notes, videos, homework help, exam practice on iPhone [DOWNLOAD]