Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Question 1. (10 points) Which of the following are not legal constants in C? Why? Classify each legal constant as either integer or floating-point. a)

image text in transcribed

image text in transcribed

image text in transcribed

image text in transcribed

Question 1. (10 points) Which of the following are not legal constants in C? Why? Classify each legal constant as either integer or floating-point. a) 010E2 b) 32.1E+5 c) 0790 d) 100 000 e) 3.9780-2 Question 2. (20 points) Write single statements or loops to accomplish each of the following: a) Display the value of the tenth element of character array ch b) Input a value into element 4 of one-dimensional floating-point array nums c) Initialize each of the five elements of one-dimensional integer array g to 8. d) Using designated initializer, initialize the first and last values of one-dimensional Boolean array vals to true and all other values false e) Total the elements of floating-point array c of 100 elements. f Copy array a into the first portion of array b. Assume double a[111, b[34] g) Initialize the 10 elements of integer array counts to zeros. h) Add 1 to each of the 20 elements of integer array bonus i) Read the 12 values of floating-point array monthlyTemperatures from the keyboard. i) Print the five values of integer array bestscores in column format. Question 3. (10 points) What output does each of the following program fragment produce? a) for i0i Problem 3. (15 points) Write a program that creates an array with five random numbers and scales all the array elements to the range of 0 to 1. Test your program by printing the array elements, scaling the array elements, and then again printing the array elements to show the result. Hint: You need to find the minimum and maximum number in the array and scale each array element as follow: xlil-min maxmin

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

The Database Management Systems

Authors: Patricia Ward, George A Dafoulas

1st Edition

1844804526, 978-1844804528

More Books

Students also viewed these Databases questions