Question

Identify and correct the errors in each of the following statements. (Note: There may be more...

Identify and correct the errors in each of the following statements. (Note: There may be more than one error per statement.)

a) scanf( "d", value );
b) printf( "The product of %d and %d is %d"\n, x, y );c) firstNumber + secondNumber = sumOfNumbers
d) if ( number => largest )

largest == number;

e) */ Program to determine the largest of three integers /*
f) Scanf( "%d", anInteger );
g) printf( "Remainder of %d divided by %d is\n", x, y, x % y );h) if ( x = y );

printf( %d is equal to %d\n", x, y );

Homework Answers

Answer #1
a) scanf( "d", value );
We have to use %d and & before variable.
FIX:
scanf( "%d", &value );

b) printf( "The product of %d and %d is %d"\n, x, y );
Add product value (x*y)
FIX:
printf( "The product of %d and %d is %d"\n, x, y, (x*y));

c) firstNumber + secondNumber = sumOfNumbers
Invert the values around = operator.
FIX:
sumOfNumbers = firstNumber + secondNumber;

d) if ( number => largest )
        largest == number;
There is no operator =>
Replace => with >=
FIX:
if ( number >= largest )
    largest = number;

e) */ Program to determine the largest of three integers /*
Comments starts with /* ends with */
FIX:
/* Program to determine the largest of three integers */

f) Scanf( "%d", anInteger );
Use & before variable name
FIX:
scanf( "%d", &anInteger );

g)
printf( "Remainder of %d divided by %d is\n", x, y, x % y );
Add %d for remainder also
FIX:
printf( "Remainder of %d divided by %d is %d\n", x, y, x % y );

h)
if ( x = y );
    printf( %d is equal to %d\n", x, y );
== is comparision operator
FIX:
if ( x == y )
    printf( %d is equal to %d\n", x, y );

Know the answer?
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
Similar Questions
1. Identify and correct the errors in each of the following statements: a) for (a =...
1. Identify and correct the errors in each of the following statements: a) for (a = 25, a <= 1, a--); {printf("%d\n", a);} b) The following code should print whether a given integer is odd or even: switch (value) {case (value % 2 == 0):puts("Even integer");case (value % 2 != 0):puts("Odd integer");} c) The following code should calculate incremented salary after 10 years: for (int year = 1; year <= 10; ++year) {double salary += salary * 0.05;}printf("%4u%21.2f\n", year, salary);...
In the following statements you may find some errors.  Line number are included to the left of...
In the following statements you may find some errors.  Line number are included to the left of each line to help with your answers. Hint: number of points equals at least the number of errors. 1: */ what’s wrong with this program? /* 2: #include iostream 3: using namespace std; 4: int main(); 5: } 6: int x,y,z \\ Three integers 7: x=24 8: y=84; 9: z=x+y, 10: Cout<"The value of z is "<Z; 11: Return; 12: {
Which of the following statements are TRUE? Note that there may be more than one correct...
Which of the following statements are TRUE? Note that there may be more than one correct answer; select all that are true. 1. a) All else being equal, the standard deviation of the sampling distribution of the sample mean will be smaller for n = 10 than for n = 40. b) The value of a statistic does not vary from sample to sample. c) Statistics have sampling distributions. d) The value of a parameter does not vary from sample...
Identify errors and correct them of the following Java program: 1. import java.utility.Random; 2. 3. public...
Identify errors and correct them of the following Java program: 1. import java.utility.Random; 2. 3. public class Sequen 4. 5. private int stand 6. private int calc; 7. 8. public Sequen(int numStand) 9. { 10. stand = numStand; 11. skip; 12. } 13. 14. public void skip() 15. { 16. Random sit = new Random(); 17. calc = sit.nextInt(stand) + 1; 18. } 19. 20. public getStand() 21. { 22. return stand; 23. } 24. 25. int getCalc() 26. {...
Identify errors and correct them of the following Java program: 1. import java.utility.Random; 2.   3. public...
Identify errors and correct them of the following Java program: 1. import java.utility.Random; 2.   3. public class Sequen 4.   5. private int stand   6. private int calc;   7.   8. public Sequen(int numStand) 9. { 10.         stand = numStand; 11.         skip; 12.         } 13.           14.         public void skip() 15.         { 16.         Random sit = new Random(); 17.         calc = sit.nextInt(stand) + 1; 18.         } 19.           20.         public getStand() 21.         { 22.         return stand; 23.         } 24.           25.         int getCalc() 26.         { 27.         return calc; 28.         } 29.         } One error is already identified for you as shown below:...
URGENT!!!!!!!!!!!!!!!!!!!!! Identify errors and correct them of the following Java program: 1. import java.utility.Random; 2.   3....
URGENT!!!!!!!!!!!!!!!!!!!!! Identify errors and correct them of the following Java program: 1. import java.utility.Random; 2.   3. public class Sequen 4.   5. private int stand   6. private int calc;   7.   8. public Sequen(int numStand) 9. { 10.         stand = numStand; 11.         skip; 12.         } 13.           14.         public void skip() 15.         { 16.         Random sit = new Random(); 17.         calc = sit.nextInt(stand) + 1; 18.         } 19.           20.         public getStand() 21.         { 22.         return stand; 23.         } 24.           25.         int getCalc() 26.         { 27.         return calc; 28.         } 29.         } One error is already identified for you as shown...
Identify errors and correct them of the following Java program: 1. import java.utility.Random; 2.   3. public...
Identify errors and correct them of the following Java program: 1. import java.utility.Random; 2.   3. public class Sequen 4.   5. private int stand   6. private int calc;   7.   8. public Sequen(int numStand) 9. { 10.         stand = numStand; 11.         skip; 12.         } 13.           14.         public void skip() 15.         { 16.         Random sit = new Random(); 17.         calc = sit.nextInt(stand) + 1; 18.         } 19.           20.         public getStand() 21.         { 22.         return stand; 23.         } 24.           25.         int getCalc() 26.         { 27.         return calc; 28.         } 29.         } One error is already identified for you as shown below:...
Identify errors and correct them of the following Java program: 1. import java.utility.Random; 2.   3. public...
Identify errors and correct them of the following Java program: 1. import java.utility.Random; 2.   3. public class Sequen 4.   5. private int stand   6. private int calc;   7.   8. public Sequen(int numStand) 9. { 10.         stand = numStand; 11.         skip; 12.         } 13.           14.         public void skip() 15.         { 16.         Random sit = new Random(); 17.         calc = sit.nextInt(stand) + 1; 18.         } 19.           20.         public getStand() 21.         { 22.         return stand; 23.         } 24.           25.         int getCalc() 26.         { 27.         return calc; 28.         } 29.         } One error is already identified for you as shown below:...
Identify errors and correct them of the following Java program: 1. import java.utility.Random; 2. 3. public...
Identify errors and correct them of the following Java program: 1. import java.utility.Random; 2. 3. public class Sequen 4. 5. private int stand 6. private int calc; 7. 8. public Sequen(int numStand) 9. { 10. stand = numStand; 11. skip; 12. } 13. 14. public void skip() 15. { 16. Random sit = new Random(); 17. calc = sit.nextInt(stand) + 1; 18. } 19. 20. public getStand() 21. { 22. return stand; 23. } 24. 25. int getCalc() 26. {...
Identify errors and correct them of the following Java program: 1. import java.utility.Random; 2. 3. public...
Identify errors and correct them of the following Java program: 1. import java.utility.Random; 2. 3. public class Sequen 4. 5. private int stand 6. private int calc; 7. 8. public Sequen(int numStand) 9. { 10. stand = numStand; 11. skip; 12. } 13. 14. public void skip() 15. { 16. Random sit = new Random(); 17. calc = sit.nextInt(stand) + 1; 18. } 19. 20. public getStand() 21. { 22. return stand; 23. } 24. 25. int getCalc() 26. {...
ADVERTISEMENT
Need Online Homework Help?

Get Answers For Free
Most questions answered within 1 hours.

Ask a Question
ADVERTISEMENT