In: Computer Science
*Write in C*
Write a program that generates a random Powerball lottery ticket number .
A powerball ticket number consists of 5 integer numbers ( between 1-69) and One power play number( between 1-25).
CODE:
#include <stdio.h>
#include <stdlib.h>
#include<time.h>
// to generate a random number between the range min-max
int myRandom(int min,int max){
return rand()%((max+1)-min) + min;
}
int main(void) {
srand(time(NULL));
printf("Powerball Ticket:\n");
for(int i=1;i<=5;i++){
printf("%d\n",myRandom(1,69));
}
printf("One power play:\n");
printf("%d\n",myRandom(1,25));
return 0;
}
OUTPUT:
Please
upvote if you like my answer and comment below if you have
any queries or need any further explanation.