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 );
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 );
Get Answers For Free
Most questions answered within 1 hours.