Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

The following code consists of 5 parts. Find the errors for each part and fix them. Explain the errors using comments on top of each

The following code consists of 5 parts. Find the errors for each part and fix them. Explain the errors using comments on top of each part.

*/

#include #include int main( ) {

////////////////////////////////////////////////////////////////////////// ////////////// Part A. (5 points) //////////////////

int g(void) { printf("%s", Inside function g\ n " ); int h(void) { printf(" % s ", Inside function h\ n "); } }

printf("Part A: "); g(); printf(" ");

////////////////////////////////////////////////////////////////////////// ////////////// Part B. (5 points) //////////////////

int sum( int x, int y ) { int result; result = x + y; }

printf("Part B: % d ", sum(5,3));

////////////////////////////////////////////////////////////////////////// ////////////// Part C. (5 points) //////////////////

void f( float a ); { float a; printf( "%f", a ); }

printf("Part C: % 1f ", f(1.1));

////////////////////////////////////////////////////////////////////////// ////////////// Part D. (5 points) //////////////////

#include #include int main( ) {

int sum( int n ) { if ( 0 == n ) { return 0; } else { n + sum( n - 1 ); } }

printf("Part D: % d ", sum(3)); return 0; }

////////////////////////////////////////////////////////////////////////// ////////////// Part E. (5 points) //////////////////

void product( void ) { int a, b, c, result; printf( "%s", "Enter three integers: " ) scanf( "%d%d%d", &a, &b, &c ); result = a * b * c; printf( "Result is: %d", result ); return result; }

printf( "Part E: %d", product ());

return 0; }

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

Readings In Database Systems

Authors: Michael Stonebraker

2nd Edition

0934613656, 9780934613651

More Books

Students also viewed these Databases questions