1. Using switch statement, write a C program to do the following problems: [0.5 mark] A)...
Fantastic news! We've Found the answer you've been seeking!
Question:
Transcribed Image Text:
1. Using switch statement, write a C program to do the following problems: [0.5 mark] A) If the user enters 1, the program prints the following structure using while loop: 1 22 333 4444 55555 B) If the user enters 2, the program prints the following structure using while loop: 12345 1234 123 12 1 B) If the user enters 2, the program prints the following structure using while loop: 1234 5 1234 123 12 2. Write a function that takes two integer inputs and returns the sum of all even numbers between these inputs, and another function that takes two integer inputs and returns the sum of odd numbers between these inputs .In main function, the program will asks the user to enter two integer numbers and then passes them to these two functions and display the result of each of them. [0.5 mark] A. Write a C program to process a collection of the speeds of vehicles. Your program should count and print the number of vehicles moving at a high speed (90 miles/hour or higher), the number of vehicles moving at a medium speed (50-90 miles/hour), and the number of vehicles moving at a slow speed (less than 50 miles/hour). It should also display the category of each vehicle. Test your program on the following data: Speed of vehicles (in miles): 43 23 54 57 68 67 51 90 33 22 11 88 34 52 75 12 78 32 89 14 65 67 97 53 10 47 34 B. Modify your program to display the average speed of a vehicle (a real number) at the end of the run. [0.75 mark] 4. Write a C program that asks the user to enter 15 integer numbers and then store them in the array. Then, the program will find the second largest clement in array and its index without sorting the array. For example, In this array (-55,-2,1, 2, -3, 0, 5, 9, 13, 1, 4, 3, 2, 1, 0}, the second largest element is 9 [found at index 7]. [0.75 mark] 1. Using switch statement, write a C program to do the following problems: [0.5 mark] A) If the user enters 1, the program prints the following structure using while loop: 1 22 333 4444 55555 B) If the user enters 2, the program prints the following structure using while loop: 12345 1234 123 12 1 B) If the user enters 2, the program prints the following structure using while loop: 1234 5 1234 123 12 2. Write a function that takes two integer inputs and returns the sum of all even numbers between these inputs, and another function that takes two integer inputs and returns the sum of odd numbers between these inputs .In main function, the program will asks the user to enter two integer numbers and then passes them to these two functions and display the result of each of them. [0.5 mark] A. Write a C program to process a collection of the speeds of vehicles. Your program should count and print the number of vehicles moving at a high speed (90 miles/hour or higher), the number of vehicles moving at a medium speed (50-90 miles/hour), and the number of vehicles moving at a slow speed (less than 50 miles/hour). It should also display the category of each vehicle. Test your program on the following data: Speed of vehicles (in miles): 43 23 54 57 68 67 51 90 33 22 11 88 34 52 75 12 78 32 89 14 65 67 97 53 10 47 34 B. Modify your program to display the average speed of a vehicle (a real number) at the end of the run. [0.75 mark] 4. Write a C program that asks the user to enter 15 integer numbers and then store them in the array. Then, the program will find the second largest clement in array and its index without sorting the array. For example, In this array (-55,-2,1, 2, -3, 0, 5, 9, 13, 1, 4, 3, 2, 1, 0}, the second largest element is 9 [found at index 7]. [0.75 mark]
Expert Answer:
Related Book For
Posted Date:
Students also viewed these finance questions
-
Determine CPI, ETC (1), and EAC. Activity Total PV 1 2 3 4 5 6 7 8 9 10 11 12 13 14 1 6 6 2 20 10 10 3 30 9 6 6 6 3 4 20 8 2 5 5 5 16 4 4 4 4 6 18 9 9 7 8 4 4 Status Report: Ending Period 5 Task %...
-
Allergan is a major pharmaceutical firm. You work for Allergan's CFO and are evaluating a major and expensive drug trial. The drug trial would require an investment of $95 million today If the trial...
-
(1) Given A and i. (1a) Find the equivalent amount at the end of year 1. (1b) Find the equilvalent amount at the end of year B. (2) Given X and i, Find the annual equivalent A from year S to 8. *...
-
Table P-23 contains Southwest Airlines' quarterly income before extraordinary items ($MM) for the years 1988-1999. a. Plot the income data as a time series and describe any patterns that exist. b. Is...
-
You are a public accountant in the public accounting firm of Lind and Hemming. One of your larger clients is Yukon Corp., a company incorporated under the Canada Business Corporations Act, which has...
-
Random samples of size 5, 20, and 80 are drawn from a population with a mean of = 100 and a standard deviation of = 15. a. Give the mean of the sampling distribution of y for each of the three...
-
What are the three components of an Expert System (ES) program? Explain what each component does.
-
Lisa Dunkley operates a sales booth in computer software trade shows, selling an accounting software package, Abacus. She purchases the package from a software company for $150 each. Booth space at...
-
If employee costs were distributed equally for both WebLink and KH Connect, for which company, and for which year, was the highest employee cost per city?
-
A beam ABCD consisting of a simple span BD and an overhang AB is loaded by a force P acting at the end of the bracket CEF (see figure). (a) Determine the deflection δA at the end of the...
-
A company has total assets of $500 million, including its accounts receivable of $120 million. The company's annual sales are $650 million. If the company's DSO is based on 360 days, then calculate...
-
What other cultural artifacts exist in our society that could be studied within a Cultural Studies framework?
-
Take a position on the essentialist argument relative to Feminist Standpoint Theory, and defend your position.
-
How do you define violence on television? Do you think its possible to calculate violent acts as Gerbner and his colleagues have done? Explain your answer.
-
Describe how Media Ecology theorists might react to the current news today? What would be his major criticisms and his major objections? What would he be particularly interested in?
-
Imagine that youre an ethnographer who has been assigned to study your schools culture. How might you go about studying it? What sort of cultural artifacts or rituals would you find?
-
4.100 (a) If the child and swing together weigh 200 N, find the force in each of the two ropes. (See Fig- ure P4.100(a).) (b) If the child's father uses a horizontal force to pull the swing back 30...
-
Create a data model for one of the processes in the end-of-chapter Exercises for Chapter 4. Explain how you would balance the data model and process model.
-
What is the accounting equation for the balance sheet?
-
What is the role of trusts in estate planning?
-
Hy Potenuse bought a $10,000 Treasury bill at 0.115 percent discount for 13 weeks (91 days). a. How much does Hy pay for the bill? b. What is the effective rate of interest?
-
How does the product life cycle influence marketing strategy decisions?
-
What are the stages in the product life cycle?
-
What is the difference between secondary demand and primary demand?
Study smarter with the SolutionInn App