Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The assignment must be printed and stapled, include name, course number, and assignment number at the top, include the source code and a screen shot

image text in transcribed
The assignment must be printed and stapled, include name, course number, and assignment number at the top, include the source code and a screen shot of the execution results for each program. Make sure to include a header and line comments in the programs. The assignment must be dear and legible. 1) Write a function that will reverse the order of the elements of an array of int variables the main() function declare an 8-element integer array, then have the user enter the value of each element using a loop. The program should then call the other function to reverse the order of the elements in the array, and then print the values of the resulting array to the screen. 2) Write a program to input a string from the user-use a loop and the getchar() function (similar to the 'capitalize c' example program we looked at in class) The program should then convert the string to all lowercase letters, and put each word on its own line. Print the new string. Example: Enter a string: This Is A STRING. this is a string 3) Write a program that will ask the user to enter an integer. The program should check if the 3rd least significant bit of the number (in binary) is a '1' or '0', and tell the user. If the bit was a '0' the program should set the bit to '1' if the bit was a '1' it should dear the bit to zero. The program should then display the new resulting integer number. 4) Write a program that will determine the number of bits required to represent a positive integer. The program should have the user enter a decimal integer, then use a loop with a bitwise operator to determine the number of bits in its binary representation. For example, if the user entered 18 (which in binary is 10010) the program should indicate 5 bits. Example: Enter a positive integer 18 Number of bits: 5

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

Marketing Database Analytics

Authors: Andrew D. Banasiewicz

1st Edition

0415657881, 978-0415657884

More Books

Students also viewed these Databases questions

Question

What is the principle of thermodynamics? Explain with examples

Answered: 1 week ago

Question

Explain the strength of acid and alkali solutions with examples

Answered: 1 week ago