Puzzle SL18


#include <stdio.h>
double dum( double x )
{
  x -= 1.0 ;
  x = dee(x);
  return x;
}

double dee( double a )
{
  if ( a > 10.0 )
    a = dum(a);
  else
    a -= 2.0;

  return a;
}

int main ( void )
{
  double x;
  
  x = dum(7.0);
  printf("scope m: x=%lf\n", x);

  return 0 ;
}

Question 1: Will the program compile and run?

Question 2: Will it produce the correct result?

Question 3: Fix or improve the program.

This is nearly the same as the previous program except that the variables are now type double. Will that make a difference?



Previous Page        Answer         Next Page         Home