Lottery Program Pseudocode

.docx

School

Gwinnett Technical College *

*We aren’t endorsed by this school

Course

1305

Subject

Electrical Engineering

Date

Dec 6, 2023

Type

docx

Pages

3

Uploaded by EarlExploration205

Lottery Program Pseudocode: Function generate_lottery_number() Integer[]: Declare Integer lottery_numbers[7] For i from 0 to 6: Set lottery_numbers[i] = random(0,9) End for Return lottery_numbers End function Function display_lottery_number(Integer[] numbers): For i from 0 to 6: Display numbers[i] End for End function Module Main Declare Integer lottery_numbers[7] = generate_lottery_number() Display "Lottery Number:" Call display_lottery_number(lottery_numbers) End module Output/ displayLotteryNumbers Generate lottery numbers MAIN
Function generate_random_array(rows, columns): Declare Integer[rows][columns] arr For each row in 1 to rows: For each column in 1 to columns: Set arr[row][column] = random(1,100) Return arr End function Function find_saddle_points(arr): Declare Integer[] saddle_points Declare rows = arr.rows Declare col = arr.columns Declare integer[][] value Declare bool is_saddle_point For i from 1 to rows: For j from 1 to columns: Set value = arr[i][j] Set is_saddle_point = true For col from 1 to columns: If arr[i][col] < value: Set is_saddle_point to false Break For row from 1 to rows: If arr[row][j] > value: Set is_saddle_point to false Break Find saddle points Generate random array Main
Your preview ends here
Eager to read complete document? Join bartleby learn and gain access to the full version
  • Access to all documents
  • Unlimited textbook solutions
  • 24/7 expert homework help