Find the error in each of the following program segments


Question: Find the error in each of the following program segments and explain how to correct it:

a) double cube( float ); // function prototype cube( float number ) // function definition { return number * number * number; }

b) int random Number = s rand();

c) double y = 123.45678; int x; x = y; printf( "%f\n", (double) x );

d) double square( double number ) { double number; return number * number; }

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

Solution Preview :

Prepared by a verified Expert
Basic Computer Science: Find the error in each of the following program segments
Reference No:- TGS02403966

Now Priced at $15 (50% Discount)

Recommended (94%)

Rated (4.6/5)