Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

1 Write a single C statement to accomplish each of the following: a ) Multiply the variable product by 2 using the ? * *

1 Write a single C statement to accomplish each of the following:
a) Multiply the variable product by 2 using the ?**= operator.
b) Multiply the variable product by 2 using the = and " operators.
c) Test whether the value of the variable count is greater than 10. If it is, print "Count is greater than 10".
d) Calculate the remainder after quotient is divided by divisor and assign the result to quotient. Write this statement two different ways.
e) Print the value 123.4567 with two digits of precision. What value is printed?
f) Print the floating-point value 3.14159 with three digits to the right of the decimal point. What value is printed?
(1)2 Write a C statement to accomplish each of the following tasks.
a) Define variable x to be of type int and set it to 1.
b) Define variable sum to be of type int and set it to 0.
c) Add variable x to variable sum and assign the result to variable sum.
d) Print "The sum is: " followed by the value of variable sum.
3 Combine the statements from Exercise 2 into a program that calculates the sum of the integers from 1 to 10. Use the while statement to loop through the calculation and increment statements. The loop should terminate when x becomes 11.
4 Write single C statements to perform each of the following task:
a) Input integer variable x with scanf. Use the conversion specification %d.
b) Input integer variable y with scanf. Use the conversion specification %d.
c) Set integer variable i to 1.
d) Set integer variable power to 1.
e) Multiply integer variable power by x and assign the result to power.
f) Increment variable i by 1.
g) Test i to see if it's less than or equal to y in the condition of a while statement.
h) Output integer variable power with printf.
5 Write a C program that uses the statements in the preceding exercise to calculate x raised to the y power. The program should have a while iteration control statement.
6 Identify and correct the errors in each of the following and fix them:
a) while )(5{
product **=c
++C
b) scanf("%.4f", &va7ue);
c) if (gender ==1){
puts ("Woman");
}
image text in transcribed

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

Finance The Role Of Data Analytics In Manda Due Diligence

Authors: Ps Publishing

1st Edition

B0CR6SKTQG, 979-8873324675

More Books

Students also viewed these Databases questions