1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
zlopas [31]
2 years ago
12

Type a statement using srand() to seed random number generation using variable seedVal. Then type two statements using rand() to

print two random integers between (and including) 0 and 9. End with a newline. Ex:
5.
7.
Note: For this activity, using one statement may yield different output (due to the compiler calling rand() in a different order). Use two statements for this activity. Also, after calling srand() once, do not call srand() again. (Notes)
1 #include
2 #include //
3 Enables use of rand ()
4 int main(void) ( int seedval;
6.
7. scanf ("%d", &seedval);
8.
9.
10 srand(int seedval);
11 printf("%d\n", srand());
12 printf("%d\n", srand());
13
14 return e;
15 }
Computers and Technology
1 answer:
Alik [6]2 years ago
8 0

Answer:

#include<stdio.h>

#include<stdlib.h>

int main(void){

int seedval;

scanf ("%d", &seedval);

srand(seedval);

printf("%d\n", rand()%10);

printf("%d\n", rand()%10);

 return 0;

}

Explanation:

The given code is poorly formatted. So, I picked what is usable from the code to write the following lines of code:

#include<stdio.h>

#include<stdlib.h>

int main(void){

This line declares seedval as integer

int seedval;

This line gets user input for seedval

scanf ("%d", &seedval);

This line calls the srand function to generate random numbers

srand(seedval);

This prints a random number between 0 and 9

printf("%d\n", rand()%10);

This also prints a random number between 0 and 9

printf("%d\n", rand()%10);

 return 0;

}

You might be interested in
Write the definition of a function minMax that has five parameters. The first three parameters are integers. The last two are se
guapka [62]

void minMax(int a, int b, int c, int*big, int*small)

{

if(a>b && a >c){

*big = a;

if(b>c)

*small = c;

else

*small = b;

}

else if (b>a && b>c){

*big = b;

if(a>c)

*small = c;

else

*small = a;

}

else{

*big = c;

if(a>b)

*small = b;

else

*small = a;

}

}

8 0
2 years ago
Identify the flaws / limitations in the following ConvertToNumber method:
lions [1.4K]

Answer:

Flaws and limitations identified in this program includes;

1.There was a not necessary usage of variable retrieval. Would have made use of canConvert.

2. Looking at the program, one will notice numerous typos. One of which is the fact that in JAVA we make use of Boolean instead of bool.

3.We rather use Integer.parseInt in JAVA and not Int16, cant make use of Int16.

4. The exception cant be printed

5. JAVA makes use of checkConversion instead of convertNumber as used in the program.

6. It cant work for decimal numbers, 0 and big integers.

Explanation:

See Answer for the detailed explaination of the flaws and limitations identified in the program.

4 0
3 years ago
Why do I keep losing my crown thingies (brainliest answers) and I lost 2 ranks in the last month? HOW? WHY? I'm starting to get
Natali [406]

there is a lag with the website mines did the same

7 0
3 years ago
Read 2 more answers
Jim wants to shoot a video. This requires him to move from one place to another. Which type of camera support should Jim use?
Arisa [49]

Answer:

I think Jim should use a movement tracker camara

Explanation:

since he is moving around the camera would follow him around

8 0
3 years ago
50-75 words about what motivates you in academic life and are these motivators different from what motivates you in your persona
drek231 [11]

<u>Answer:</u>

<em>My teachers & My parents are the main reason to get through academics well. </em>

Though the reason might be common to most of the people, <em>the situation might be unique and the way the advice's are comprehended and the process of intake and the actions would be unique to each person.</em>

How a mother gives medicine to a child along with sugar, in a similar way my <em>parents and teachers gave me advice which made me to stand at this top-level.</em>

6 0
3 years ago
Other questions:
  • You are running an application in Google App Engine that is serving production traffic. You want to deploy a risky but necessary
    9·1 answer
  • The equipment that processes data in order to create information is called the _______.
    8·2 answers
  • A virtual private network (VPN) is used to securely connect to another network over a insecure network.
    9·2 answers
  • You have just driven to the Hewlett-Packard site in Corvallis to field-interview a programmer. You sit down in a conference room
    6·1 answer
  • PLEASE HELP ME ASAP!!!!
    11·1 answer
  • Which act requires that financial institutions must provide a privacy notice to each consumer that explains what data about the
    12·1 answer
  • Which of the following statements are true regarding models? Select 3 options.
    11·1 answer
  • Create a program that allows the user to input a list of first names into one array and last names into a parallel array. Input
    12·1 answer
  • How does the sky change as onegets above Earth’s atmosphere?
    5·1 answer
  • Steps to copy and paste text/information from website to Ms-word using keyboard​
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!