From: | Lisa Reilman <lr425(at)stl(dot)rural(dot)usda(dot)gov> |
---|---|
To: | pgsql-general(at)postgreSQL(dot)org |
Subject: | my C pgm |
Date: | 2000-11-16 20:23:02 |
Message-ID: | 3A144225.A40C9D30@stl.rural.usda.gov |
Views: | Raw Message | Whole Thread | Download mbox | Resend email |
Thread: | |
Lists: | 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
From | Date | Subject | |
---|---|---|---|
Next Message | Bernie Huang | 2000-11-16 20:30:16 | Postgres session |
Previous Message | Matthew | 2000-11-16 19:27:20 | RE: [HACKERS] Re: PHPBuilder article -- Postgres vs My SQL |