Question

Rewrite the if statement below using only the relational operator < in all conditions

 Rewrite the if statement below using only the relational operator < in all conditions. Assume that the value of score is between 0 and 100 inclusive.

image.png

 Rewrite the following code segment as an equivalent segment that uses a do-while statement.

image.png

 Assuming the following declaration:

 char my array[9] = ['C', 'p', 't', 'S', '', '1', '2', '1');

 What is the value of *(myarray, + 4)?

 What will be the values of k[1], k[2], and k[3] after execution of the code segment below

 assuming the input data shown?

image.png

3 0
Add a comment Improve this question Transcribed image text
Answer #1

1)

#include

int main()

{
int score;
printf("Enter score ");
scanf("%d",&score);

switch( score / 10 )
{

case 10:
case 9:
printf("A\n");
break;

case 8:
printf("B\n");
break;
default:
printf("C\n");
break;

}

return 0;
}

2)

#include

int main () {
int sum=0,next=1,bound=10;
do {
sum+=(++next);
} while(next }

value of *(my_array[4])=0x20

3) k[1]=0

k[2]=42

k[3]=6

Add a comment
Know the answer?
Add Answer to:
Rewrite the if statement below using only the relational operator < in all conditions
Your Answer:

Post as a guest

Your Name:

What's your source?

Earn Coins

Coins can be redeemed for fabulous gifts.

Not the answer you're looking for? Ask your own homework help question. Our experts will answer your question WITHIN MINUTES for Free.
Similar Homework Help Questions
  • Rewrite the if statement below using only the relational operator < in all conditions

     53.  Rewrite the if statement below using only the relational operator < in all conditions. Assume that the value of score is between 0 and 100 inclusive. 54.  Rewrite the following code segment as an equivalent segment that uses a do-while statement. 55.  Assuming the following declaration: char my array[9] - ['C', 'p', 't', 'S', '9, '1', '2', '1']; What is the value of*(my array +4)?

  • A) Rewrite the following pseudocode segment in C++ using the loop structures (for and while). Assume...

    A) Rewrite the following pseudocode segment in C++ using the loop structures (for and while). Assume that all the variables are declared and initialized. k-G+ 13)/27 loop: if k> 10 then goto out k=k+1 i=3"k-1 goto loop I out: B) Rewrite the following code segment in C++ using the multiple-selection (switch and if-else) statements. Assume that all the variables are declared and initialized. if((k 1) || (k 2))j-2 k-1 if ((k 3) || ( ks))j - 3.k+1 if (k 4)j-4k-1...

  • please try to solve these in less than 30 minutes.ı only need answer options ı do...

    please try to solve these in less than 30 minutes.ı only need answer options ı do not need explanations of answers.thank you . 12. Which one of the conditions that follow will be false (value of o) after execution of the program segment below? int v[5] = {0, 0, 0, 0, 1); int k, for (1 = 3; 1 > 0; 3) for (k = j, k < 4; ++) V[K] += v[k + 1]; a. V[0] == v[4] b...

  • use java and write in text a. Rewrite the following code segment using if statements. Assume...

    use java and write in text a. Rewrite the following code segment using if statements. Assume that grade has been declared as of type char. char grade= 'B';; switch (grade) { case 'A': System.out.println("Excellent"); break case 'B': System.out.println("Good"); default: System.out.println("you can do better”); } - b. write Java code that inputs an integer and prints each of its digit followed by ** e.gif the integer is 1234 then it should print 1**2**3**4 e.g. if the integer is 85 then it...

  • Fill the blank in each of the following using the terms at the bottom. IT. When...

    Fill the blank in each of the following using the terms at the bottom. IT. When an array is created, a value in the array is called a(n) 12. f and ) must always be used with an if) statement: True or False 13. Theoperator is used to check if two values are equal. 14. A command can only be used in a loop statement. 15. Acommand can be used in both a loop and switch statement. 16. In the...

  • _28. Using the following function prototype which statement about the argument passed to parameter Als true....

    _28. Using the following function prototype which statement about the argument passed to parameter Als true. void F(const int A[], int Cnt): A. The argument is modified when changes are made to parameter A in function F. B. The argument passed to parameter A must always have the same number of elements, every time function Fis invoked. C. Changes can not be made to parameter A in function F. D. Every element of the argument passed to parameter A must...

  • Question 47 (1 point) What is the output generated by the code segment below, assuming that...

    Question 47 (1 point) What is the output generated by the code segment below, assuming that source is a Scanner object used to read the following text: Suzy sells seashells on the seashore. source.useDelimiter(" "); int count = 0; while (source.hasNext()) { char input = source.next().charAt(0); if (Character.isLetter (input)) count++; { } System.out.println(count); A/

  • Multiple Choice Multiple Choice Section 4.1 Pointers and Dynamic Memory Consider the following statements: int *p;...

    Multiple Choice Multiple Choice Section 4.1 Pointers and Dynamic Memory Consider the following statements: int *p; int i; int k; i = 42; k = i; p = &i; After these statements, which of the following statements will change the value of i to 75? A. k = 75; B. *k = 75; C. p = 75; D. *p = 75; E. Two or more of the answers will change i to 75. Consider the following statements: int i =...

  • State true or false: (6 x 2 = 12 pts) Using -- with a reverse iterator...

    State true or false: (6 x 2 = 12 pts) Using -- with a reverse iterator moves it from the back toward the front of a list b) The body of a do-while loop is always executed at least once. c) If p points to the array element a[j], then p + i points to a[i+j]. d) Any number of pointer variables may point to the same object. In terms of both execution speed and memory usage usually iterative solutions...

  • Rewrite the C++ code below so the the following conditions are met: You may create any...

    Rewrite the C++ code below so the the following conditions are met: You may create any number of classes. You may edit the main() function. Remove the variable string type completely from the entire program. -- Note: Entire program includes all classes, all functions, and main(). Get rid of every if and if else statement completely from the entire program. -- Note: Entire program includes all classes, all functions, and main(). Hint: Use polymorphism. #include <iostream> #include <vector> #include <algorithm>...

ADVERTISEMENT
Free Homework Help App
Download From Google Play
Scan Your Homework
to Get Instant Free Answers
Need Online Homework Help?
Ask a Question
Get Answers For Free
Most questions answered within 3 hours.
ADVERTISEMENT
ADVERTISEMENT
ADVERTISEMENT