write a program to print the summation of any two numbers by using basic 256
Answers
The first command to learn is “print”, which prints out its arguments to the text output screen. If the argument is a text string, delimited by quote (“) – and printed in red – then it is printed as-is. If it were a numerical expression, the evaluated result of the expression is printed out. Most of the math expressions using ordinary operators like +, -, / and * are available.
Print command, by default, makes a new line. In the third line, the print statement is ended with a semicolon(;), which instructs Basic256 do not start a new line, and the output is printed next to the last print result. Thus, the third line prints out “1+3 = “ as is, and the fourth line prints out the result 4, without making a new line.
(Exercise) Write a program that prints out the following text, or computes the numerical results.
1+3*5
10/3
12345*67890
“Hello, My Name is (Your Name)”
A little more detail about math expressions.
^ : Power expression: 3 ^ 2 = 3 * 3 = 9
% : Modulus (remainder) : 10 % 3 = 1
Simple program – Input
Now it’s time to learn about input. The command is, naturally, “input.” Try this simple program.
1-3 input your name
First, you instruct the user to input his name and a number. The trailing $, in the second line, means that the result is a text string. Without $ at the end, Basic256 interprets the input as a number. Now, look at the right panel. The user input his name (“Kirloy”) and his favorite number (345). His name Kirloy is stored in the variable name$, and the number is now stored in the variable number. The stored values can be verified by the print statements at lines 7 and 8.
One more tip at lines 7 and 8: the plus(+) sign applied to strings means concatenation (pasting) of strings.
In fact, the print – input pairs can be simplified to a single input statement, as follows. Simply place the prompt string before the variable, separated by comma (“,”).
brainly.in/question/25457470