Presentation is loading. Please wait.

Presentation is loading. Please wait.

Writing Program Code in BASIC Write a program to prompt for and accept values into TWO variables, numx and numy. The program should square the value stored.

Similar presentations


Presentation on theme: "Writing Program Code in BASIC Write a program to prompt for and accept values into TWO variables, numx and numy. The program should square the value stored."— Presentation transcript:

1 Writing Program Code in BASIC Write a program to prompt for and accept values into TWO variables, numx and numy. The program should square the value stored in numx than interchange the values in TWO variables and print these values.

2 Writing Program Code in BASIC Check YOUR understanding. Write a program which prompts the user to enter the price of an item and which calculates and prints the new price after a discount of 12%.

3 Writing Program Code in BASIC Whilst you’re in the mood … Write a program to accept the radius of a circle, r, and compute and print its circumference based on the formula: 2πr. The value of π is 3.142

4 Writing Program Code in BASIC Write a program to read in TWO integers into variables A and B. Print these values. The program should store the smaller in A and the larger in B, and then print A and B. Print the value obtained by dividing the LARGER number by the SMALLER number. You may assume that the numbers are not equal. Write a program to read in TWO integers into variables A and B. Print these values. The program should store the smaller in A and the larger in B, and then print A and B. Print the value obtained by dividing the LARGER number by the SMALLER number. You may assume that the numbers are not equal.

5 Writing Program Code in BASIC Write a structured algorithm to accept values in TWO variables A & B. Print the product of these two variables if it is greater than or equal to 100, otherwise print “SORRY – not enough” Write a structured algorithm to accept values in TWO variables A & B. Print the product of these two variables if it is greater than or equal to 100, otherwise print “SORRY – not enough”

6 Writing Program Code in BASIC Check YOUR understanding. Write a program in BASIC to read in the values of two numbers, find their sum, then their product. Check whether the product is bigger than the sum. If the product is bigger, it must print a message to say so, and if the product is not bigger it must print a message saying that the product is not bigger. © CXC – June 2003

7 Writing Program Code in BASIC Using COUNT-CONTROLLED LOOPS Write a program in BASIC to print the 2 times multiplication table. Table should have the format: 2 x 1 = 2 2 x 2 = 4.. 2 x 12 = 24

8 Writing Program Code in BASIC Using COUNT-CONTROLLED LOOPS Write a program using BASIC to find the sum of M numbers where the user supplies the value of M and types the numbers, in response to the prompts generated by the program.

9 Writing Program Code in BASIC Using COUNT-CONTROLLED LOOPS Try this one. Write a program in BASIC to do the following: i. Announce (with a printed statement) that it will find the volumes of sets of boxes ii. Ask how many boxes there are iii. For EACH box, ask for the length, width, and height iv. Compute the volume of EACH box. If the values of length, width and height are all greater than zero, then print the volume. v. When finished with all the boxes, print the message: “Volumes have been found”.

10 Writing Program Code in BASIC Using CONDITION-CONTROLLED LOOPS Write a program in BASIC to accept and print a positive integer.

11 Writing Program Code in BASIC Write a program to read a positive integer N and find the average of all even numbers between 1 and N inclusive. Perform any necessary validation. Write a program to read a positive integer N and find the average of all even numbers between 1 and N inclusive. Perform any necessary validation.

12


Download ppt "Writing Program Code in BASIC Write a program to prompt for and accept values into TWO variables, numx and numy. The program should square the value stored."

Similar presentations


Ads by Google