Academic Integrity: tutoring, explanations, and feedback — we don’t complete graded work or submit on a student’s behalf.

Problem: Ask the user for a range of integer values and produce a random number

ID: 3646183 • Letter: P

Question

Problem:
Ask the user for a range of integer values and produce a random number that falls within that range.
To generate the best numbers possible you will time seed the random number generator once before you use it for the first time
The user will provide as input a power of ten and you will generate a second value that is between 0 and the power designated by the user minus 1. This value will be the remainder.
Display the complete number while formatting the numeric input to two times the power of ten specified minus one decimal places.

Explanation / Answer

please rate - thanks

please remember to rate the best answer first


#include <stdio.h>
#include<time.h>
#include <stdlib.h>
#include <conio.h>
#include <conio.h>
int main()
{srand(time(0));
int range, num, power;
printf("Enter a power of ten: ");
scanf("%d",&power);
range=pow(10,power);
num=rand()%range;
printf("the random number between 0 and %d is %d ",range,num);
getch();
return 0;
}

Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
Chat Now And Get Quote