Worksheet - 1D Array
Worksheet - 1D Array
Gulistan-e-Jauhar Campus
Topic: 1D Array
STUDENTNAME:________________________________DATE:____________________
20 Lower Bound=____1_______
40 MyList[3] =_______20_______
25 MyList[5] = ____40__________
___________________________________________________________________________
Write a pseudocode of a program in which input a number and stores it in an array at position 3.
INPUT Number
___________________________________________________________________________
Construct an array of 564 elements and stores names in it which user will input.
NEXT Count
Ask user to input search value and search at which position the searched value is stored.
N.O.A = Numbers
Output the position if search value is found or output “not found” if search value is not found.
Index← 1
Found ← FALSE
REPEAT
IF Name[Index] = Searchvalue
THEN
Position ← Index
Found ← TRUE
END IF
Index← Index +1
IF Found=TRUE
THEN
OUTPUT Position
ELSE
Write an algorithm to input 100 numbers. Output how many are positive, negative or zero.
IF Number > 0
THEN
PosNum← PosNum + 1
ELSE
IF Number < 0
THEN
NegNum← NegNum +1
ELSE
IF Number= 0
THEN
Zero← Zero+1
ENDIF
NEXT Count
OUTPUT “Total positive values are”, PosNum “, total negative values are” NegNum, “and total number
of zeroes is “ Zero
____00010011_______________________________________________________________________
___________________________________________________________________________
___________________________________________________________________________
____________00111000______________________________________________________________
___________________________________________________________________________
___________________________________________________________________________