C Programming Not C++, pls a) Write a main function that declares an array of 10 int’s. Assign each element in the array a value between 1 and 100 using 10 assignment statements – just make up the values. Write a for loop that will printout each of the elements in the array.

Computer Networking: A Top-Down Approach (7th Edition)
7th Edition
ISBN:9780133594140
Author:James Kurose, Keith Ross
Publisher:James Kurose, Keith Ross
Chapter1: Computer Networks And The Internet
Section: Chapter Questions
Problem R1RQ: What is the difference between a host and an end system? List several different types of end...
icon
Related questions
Question
C Programming
Not C++, pls
a)
Write a main function that declares an array of 10 int’s. Assign each element in the array a value between 1 and 100
using 10 assignment statements – just make up the values.
Write a for loop that will printout each of the elements in the array.
 
b)
Start from scratch on each of the parts.
Write a main function that declares an array of 100 doubles.
In a for loop, assign each of the doubles a random number between 0.50 and 50.00. Here’s how.
array[i] = (double) (rand() % 100 + 1) / 2.0;

Output the elements of the array in 10 columns that are each 6 spaces wide.
Each row in the output will have 10 values. The doubles will be printed with 2 places of accuracy past the decimal.
The output of this one-dimensional array requires a single loop with an if statement inside. Even though the 100
numbers are going to be presented as a table of numbers, they are still just a list in memory.

c)
Write a main function that declares an array of 100 ints. Fill the array with random values between 1 and 100.
Calculate the average of the values in the array. Output the average.

d)
In a main function declare an array of 1000 ints.
Fill up the array with random numbers that represent the rolls of a die. That means values from 1 to 6.
Write a loop that will count how many times each of the values appears in the array of 1000 die rolls.
Use an array of 6 elements to keep track of the counts, as opposed to 6 individual variables.
 
Print out how many times each value appears in the array.
1 occurs XXX times
2 occurs XXX times
Hint: If you find yourself repeating the same line of code you need to use a loop. If you declare several variables that
are almost the same, maybe you need to use an array. count1, count2, count3, count4, ... is wrong. Make an array and
use the elements of the array as counters. Output the results using a loop with one printf statement. This gets more
important when we are rolling 2 dice.


Print out how many times each value appears in the array.
1 occurs XXX times
2 occurs XXX times
Expert Solution
trending now

Trending now

This is a popular solution!

steps

Step by step

Solved in 3 steps with 1 images

Blurred answer
Recommended textbooks for you
Computer Networking: A Top-Down Approach (7th Edi…
Computer Networking: A Top-Down Approach (7th Edi…
Computer Engineering
ISBN:
9780133594140
Author:
James Kurose, Keith Ross
Publisher:
PEARSON
Computer Organization and Design MIPS Edition, Fi…
Computer Organization and Design MIPS Edition, Fi…
Computer Engineering
ISBN:
9780124077263
Author:
David A. Patterson, John L. Hennessy
Publisher:
Elsevier Science
Network+ Guide to Networks (MindTap Course List)
Network+ Guide to Networks (MindTap Course List)
Computer Engineering
ISBN:
9781337569330
Author:
Jill West, Tamara Dean, Jean Andrews
Publisher:
Cengage Learning
Concepts of Database Management
Concepts of Database Management
Computer Engineering
ISBN:
9781337093422
Author:
Joy L. Starks, Philip J. Pratt, Mary Z. Last
Publisher:
Cengage Learning
Prelude to Programming
Prelude to Programming
Computer Engineering
ISBN:
9780133750423
Author:
VENIT, Stewart
Publisher:
Pearson Education
Sc Business Data Communications and Networking, T…
Sc Business Data Communications and Networking, T…
Computer Engineering
ISBN:
9781119368830
Author:
FITZGERALD
Publisher:
WILEY