#4 Learn Small Basic Programming - Arithmetic Operations

Share
Embed
  • Published on Apr 22, 2019
  • This video series is designed to help introduce beginners to programming using Small Basic.
    In this episode I cover the basic arithmetic operations necessary in most programs, and show how to carry out the operations, using input and displaying the output correctly.
  • Howto & StyleHowto & Style

Comments • 6

  • Rehan TV
    Rehan TV Month ago

    please i need to do like this when it says select an option from 4 to 7 row then i need to type 1 and it + when i select 2 it - when i select 3 multiplication please can you help me please

    • The Tech Train
      The Tech Train  5 days ago

      Here's the code I think you're after:
      TextWindow.ForegroundColor="Green"
      TextWindow.WriteLine("Arithmetic Operations")
      TextWindow.WriteLine("----------------------------")
      TextWindow.WriteLine("1. Addition")
      TextWindow.WriteLine("2. Subtraction")
      TextWindow.WriteLine("3. Multiplication")
      TextWindow.WriteLine("4. Division")
      TextWindow.WriteLine("----------------------------")
      TextWindow.Write("Please enter the first number: ")
      first=TextWindow.Read() 'This creates a variable called 'first' and stores the value entered
      TextWindow.Write("Please enter the second number: ")
      second=TextWindow.Read() 'This creates a variable called 'second' and stores the value entered
      TextWindow.WriteLine("Select an option from 1 to 4")
      choice=TextWindow.Read()
      If choice=1 Then
      TextWindow.WriteLine(first + " + " + second + " = " + (first+second))
      ElseIf choice=2 then
      TextWindow.WriteLine(first + " - " + second + " = " + (first-second))
      ElseIf choice=3 then
      TextWindow.WriteLine(first + " * " + second + " = " + (first*second))
      ElseIf choice=4 then
      TextWindow.WriteLine(first + " / " + second + " = " + (first/second))
      Else
      TextWindow.WriteLine("No valid choice entered.")
      EndIf

  • Rehan TV
    Rehan TV Month ago

    TextWindow.ForegroundColor="Green"
    TextWindow.WriteLine("Operacioneto aritmetike")
    TextWindow.WriteLine("----------------------------")
    TextWindow.WriteLine("1.+")
    TextWindow.WriteLine("2.-")
    TextWindow.WriteLine("3.multiplication")
    TextWindow.WriteLine("4.division")
    TextWindow.WriteLine("----------------------------")
    TextWindow.Write("Please enter the first number: ")
    TextWindow.Read()
    TextWindow.Write("Please enter the second number: ")
    TextWindow.Read()
    TextWindow.WriteLine("Select an option from 4 to 7 row")

    • The Tech Train
      The Tech Train  5 days ago

      I've looked at your code, and tried to work out what it is you're wanting to do. I'll post my suggested code on your third comment.

  • Rehan TV
    Rehan TV Month ago

    hey please can you help me ?
    i need to complete a project
    and i need your help please

    • The Tech Train
      The Tech Train  5 days ago

      I'm so sorry, I have been so busy with my students' work recently (final exams, coursework deadlines) that I haven't been replying to comments on here as quickly, and have only just come to yours. I see you;ve posted two further messages, so I'll check those now, and reply to them.