Answered step by step
Verified Expert Solution
Question
1 Approved Answer
Use of C programming language coding Lab3-3. Lucky Draw Lookup Below you will find a C program partially completed by Peter that asks the user
Use of C programming language coding
Lab3-3. Lucky Draw Lookup Below you will find a C program partially completed by Peter that asks the user for a number from 1 to 100 and replies whether he/she has won the lucky draw! \#include int main(void) \{ int prizeLookup[] = {1,0,0,2,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 0,0,0,0,0,0,0,0,0,0, 1,0,0,0,0,0,0,0,0,0, 1,0,0,0,0,0,0,0,0,0, // lookup table to be completed \} ; int num; scanf("8d",&num); if (prizeLookup [ num-1 ]=2){ printf("You won a top prize!"); \} // conditions to be completed return 0 ; \} An array " prizelookup [100] " will be set up to show whether the number (num) is corresponding to a Top Prize (with a value of 2), a Consolation Prize (with a value of 1) or No Prize (with a value of 0). In reality, the numbers that lead to prizes is set to be: Top prize: Number 4 Consolation prizes: Numbers 1,31,41,61,71,99 and 100 No prize: All other numbers Please copy and complete the program so that it will function properly. You have to update the content of the prizeLookup array according to the prize information listed above. Assume input is always valid. Input An integer. Output Either one of the following: - No prize :( - You won a top prize! - You won a consolation prize! Sample Input 1 Sample Output 1 Sample Input 2 Sample Output 2 Sample Input 3 Sample Output 3 9 No prize :( Sample Input 4 ] Sample Output 4 31 You won a consolation prize! Sample Input 5 Sample Output 5 51 No prize : ( Sample Input 6 Sample Output 6 61 You won a consolation prizeStep by Step Solution
There are 3 Steps involved in it
Step: 1
Get Instant Access to Expert-Tailored Solutions
See step-by-step solutions with expert insights and AI powered tools for academic success
Step: 2
Step: 3
Ace Your Homework with AI
Get the answers you need in no time with our AI-driven, step-by-step assistance
Get Started