Courses » SS3 » SS3 ICT » Programming Activities - SS3 ICT Lesson Note

Programming Activities - SS3 ICT Lesson Note

1. Output the sum of the first 100 integers:

In a high-level language like BASIC, you can calculate the sum of the first 100 integers using a loop. Here's a basic example in pseudo-code:

 

css Copy code

total = 0

FOR i = 1 TO 100

    total = total + i

NEXT i

PRINT "Sum of first 100 integers is: "; total

 

2. Output the values of elements in a given array:

You can use an array to store a collection of values and then print those values. Here's a simplified example:

 

BASIC Copy code

DIM numbers(10)

numbers(1) = 10

numbers(2) = 20

numbers(3) = 30

 

FOR i = 1 TO 3

    PRINT "Element "; i; ": "; numbers(i)

NEXT i

These examples demonstrate how high-level languages like BASIC can be used to perform tasks such as calculating sums and working with arrays in a more user-friendly way compared to low-level languages.

Recommended: Questions and Answers on Basic Programming IV for SS3 ICT
Please share this, thanks:

Add a Comment

Notice: Posting irresponsibily can get your account banned!

No responses