#include <stdio.h>

#include <stdlib.h>

 

void getinput(char *prmpt, float *x, float *y, float *z);

 

main()

{

  char ans, buf[10];

  float x1, x2, x3, sum;

 

  do {

    getinput("Input three numbers: ", &x1, &x2, &x3);

    sum = x1 + x2 + x3;

    printf("The sum is %f\n", sum);

    printf("Go again? ");

    gets(buf);

    ans = toupper(*buf);

  } while(ans == 'Y');

  return 0;

}

 

void getinput(char *prmpt, float *x, float *y, float *z)

{

  char buf[80];

 

  printf(prmpt);

  gets(buf);

  sscanf(buf, "%f %f %f", x, y, z);

}