Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Find the error in each of the following. (Note: There may be more than one error.) a) For (x = 100, x >= 1, ++x)

Find the error in each of the following. (Note: There may be more than one error.)

a) For (x = 100, x >= 1, ++x) { printf("%d ", x); }

b) The following code should print whether a given integer is odd or even: switch (value % 2) { case 0: puts("Even integer"); case 1: puts("Odd integer"); }

c) The following code should input an integer and a character and print them. Assume the user types as input 100 A. scanf("%d", &intVal); charVal = getchar(); printf("Integer: %d Character: %c ", intVal, charVal);

d) for (x = .000001; x == .0001; x += .000001) { printf("%.7f ", x); }

e) The following code should output the odd integers from 999 to 1: for (x = 999; x >= 1; x += 2) { printf("%d ", x); }

f) The following code should output the even integers from 2 to 100: counter = 2; Do { if (counter % 2 == 0) { printf("%u ", counter); } counter += 2; } While (counter < 100);

g) The following code should sum the integers from 100 to 150 (assume total is initialized to 0): for (x = 100; x <= 150; ++x); { total += x; }

Written in"C", please show how it is put into the compiler so it can be run, thanks.

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

Advanced Oracle Solaris 11 System Administration

Authors: Bill Calkins

1st Edition

0133007170, 9780133007176

More Books

Students also viewed these Databases questions

Question

Why is the you attitude important in business communication? [LO-1]

Answered: 1 week ago

Question

How can you use sentence style to emphasize key thoughts? [LO-5]

Answered: 1 week ago

Question

In what ways can transitions be established? [LO-6]

Answered: 1 week ago