I need to write a menu driven program that allows a user to enter five numbers and then choose between finding the smallest, largest, sum, or average.(adsbygoogle = window.adsbygoogle || []).push({});

So far I have this, which still gives me lots of errors, and I'm not even sure if I can fix it.

Code (Text):#include <stdio.h>

#include <stdlib.h>

void getData (float*a, float*b, float*c);

float calc(int option, float a, float b, float c);

int main (void)

{

int option;

do

{

option = getOption();

if (option != 5)

getData (&a, &b ,&c);

calc (option, a, b, c);

}

while();

return 0;

}

int getOption (void)

{

printf("Menu\n1- Smallest\n2- Largest\n3- Sum\n4- Avg");

scanf("%d", &option);

return option;

}

float calc (int option, float a, float b, float c)

{

float result;

switch (option)

{

case 1: result = smallest (a, b, c);

break;

case 2: result = largest (a, b, c);

break;

case 3: result = Sum (a, b, c);

break;

case 4: result = Avg (a, b, c);

break;

}

result = 1.0;

return result;

}

void getData (float*a, float*b, float*c)

{ printf("Enter 3 numbers: ");

scanf("%f %f %f", &a, &b, &c);

return 0;

}

float smallest (float a, float b, float c)

{

if (a<b && a<c)

return a;

else if (b<a && b<c)

return b;

}

**Physics Forums | Science Articles, Homework Help, Discussion**

Join Physics Forums Today!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

The friendliest, high quality science and math community on the planet! Everyone who loves science is here!

# Calculator-like program

**Physics Forums | Science Articles, Homework Help, Discussion**