my C pgm - Mailing list pgsql-general

From Lisa Reilman
Subject my C pgm
Date
Msg-id 3A144225.A40C9D30@stl.rural.usda.gov
Whole thread Raw
Responses Re: my C pgm  (<bmccoy@chapelperilous.net>)
List pgsql-general
This program is suppose to have averagefunc that accepts 5 floating
point numbers as arguments and return the average to two decimal places.

I keep getting syntax errors on lines 6 & 26 and on line 29 is says
unspecified a,b,c,d,e.

I've tried everything.  What am I doing wrong?

1  /*Lisa Reilmann C pgm#1*/
2  /*This pgm averages 5 floating point numbers*/
3  #include <stdio.h>
4
5  float num1, num2, num3, num4, num4, num5, avg;
6  float averagefunc (float a, float b, float c, float d, float e);
7  main()
8  {
9  printf("Enter a floating point number");
10 scanf("%f", &num1);
11
12 printf("Enter another floating point number");
13 scanf("%f", &num2);
14
15 printf("Enter another floating point number");
16 scanf("%f", &num3);
17
18 printf("Enter another floating point number");
19 scanf("%f", &num4);
20
21 printf("Enter a final floating point number");
22 scanf("%f", &num5);
23 avg=averagefunc(num1, num2, num3, num4, num5);
24 printf("The average is %1.2f", avg);
25 }
26 float averagefunc (float a, float b, float c, float d, float e)
27 {
28 float avg1;
29 avg1=(a + b + c + d + e)/5;
30 return avg1;
31 }

Thanks
L. reilmann


pgsql-general by date:

Previous
From: "Reverend Trance Overlord"
Date:
Subject: "COPY table FROM file" status
Next
From: "DJKA"
Date:
Subject: About PostgreSQL large objects