Computer Science, asked by amanAlexperb, 1 year ago

Identify and Correct the Errors in the Given Statements
Identify and correct the errors in each of the following statements. (Note : There may be more than one error per statement.) a) printf("The product of %d and %d is %d"\n, x, y ); b) firstNumber + secondNumber = sumOfNumbers c) printf("Remainder of %d divided by %d is\n", x, y, x % y ); d) printf(%d is equal to %d\n", x, y ); e) print("The sum is %d\n," x + y ); f) Printf("The value you entered is:%d\n, &value );

Answers

Answered by kvnmurty
2
a) printf("The product of %d and %d is %d"\n, x, y );
       There should be a third identifier, expression, variable , parameter.
             printf("The product of %d and %d is %d"\n, x, y , x * y );

b) firstNumber + secondNumber = sumOfNumbers
        The expression on the LHS of "=" operator should have an L value ie., an address.  The variable that stores the result should be on the LHS.  Add a statement/expression delimiter or terminator  "," or " ;."

                  sumOfNumbers = firstNumber + secondNumber ;

c) printf("Remainder of %d divided by %d is\n", x, y, x % y );
                %d is missing.
       printf("Remainder of %d divided by %d is %d\n", x, y, x % y );

d) printf(%d is equal to %d\n", x, y );
          
printf( " %d is equal to %d\n", x , y );     
    
e) print("The sum is %d\n," x + y );
             printf

f) Printf("The value you entered is:%d\n, &value );
         printf("The value you entered is:%d\n ",  value );

Similar questions