Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Hi this is a C program coding I have completed...but I need help in terms of file input/ouput F I/O.... Can you guys help add

Hi this is a C program coding I have completed...but I need help in terms of file input/ouput F I/O.... Can you guys help add that file input/output coding inside this Coding of mine...thank you

#include #include #include const int idealvalue = 0; const int VD = 7; const float PHSV = 8.5; const int ECSV = 250; const int TDSSV = 500; const int THSV = 300; const int CALSV = 75; const int CHLOSV = 250; const int NITSV = 50; const int SULPSV = 200; const int DOSV = 5; const int BODSV = 5; const float PHUW = 0.2190; const float ECUW = 0.3710; const float TDSUW = 0.0037; const float THUW = 0.0062; const float CALUW = 0.025; const float CHLOUW = 0.0074; const float NITUW = 0.0412; const float SULPUW = 0.0124; const float DOUW = 0.3723; const float BODUW = 0.3723;

float average(float data[][11], int); float dataqi(float avg[], int); void classwqi(float); int main() { float observed_values [10][11]; int i,j; for (i=0; i<10; i++) { for (j=0; j<11; j++){ if(i==0) { printf("Enter value for pH %d: ", j); scanf("%lf", &observed_values[i][j]);} if(i==1) { printf("Enter value for Electric Conductivity %d: ", j); scanf("%lf", &observed_values[i][j]);} if(i==2) { printf("Enter value for Total Dissolved Solids %d: ", j); scanf("%lf", &observed_values[i][j]);} if(i==3) { printf("Enter value for Total Hardness %d: ", j); scanf("%lf", &observed_values[i][j]);} if(i==4) { printf("Enter value for Calcium %d: ", j); scanf("%lf", &observed_values[i][j]);} if(i==5) { printf("Enter value for Chlorides %d: ", j); scanf("%lf", &observed_values[i][j]);} if(i==6) { printf("Enter value for Nitrates %d: ", j); scanf("%lf", &observed_values[i][j]);} if(i==7) { printf("Enter value for Sulphates %d: ", j); scanf("%lf", &observed_values[i][j]); } if(i==8) { printf("Enter value for Dissolved Oxygen %d: ", j); scanf("%lf", &observed_values[i][j]);} if(i==9) { printf("Enter value for BOD %d: ", j); scanf("%lf", &observed_values[i][j]);} } printf(" "); } float avg[10]; for (i=0; i<10; i++) { avg[i]= average(observed_values, i); } for (i=0; i<10;i++) { printf(" The average for row %d is %lf ", i, avg[i]); } float sum_wqi=dataqi(avg,2); printf(" WQI: %.2f ", sum_wqi); classwqi(sum_wqi); } float average (float numb[][11], int r) { float number[11]; int j,i; for (j=0; j<11; j++) { number[j]=numb[r][j]; } int n; for (i = 0; i < n; ++i) { for (j = i + 1; j < n; ++j) { if (number[i] > number[j]) { float a = number[i]; number[i] = number[j]; number[j] = a; } } } printf("The numbers arranged in ascending order are given below "); for (i = 0; i < n; ++i) printf("%.2lf, ", number[i]); printf(" "); float a, b, c, outlier, new_input[i]; float newsum,avrg; newsum =0; float IQR , low_lim, up_lim ; float highest, lowest; highest = number[0]; lowest = number[0]; for ( i = 0; i <11; ++i) { if (number[i] > highest) highest = number[i]; } printf("Highest is = %.1f ", highest);// Highest for ( i = 0; i < 11; ++i) { if (number[i] < lowest) lowest = number[i]; } printf("Lowest is = %.1f ", lowest); // Lowest

float sum; sum = 0.0 ; for ( i = 0; i <11; ++i) { sum = sum + number[i]; } printf ("Sum = %.1f ", sum); // Sum of input float mean ; mean = sum / 11 ; printf ("Mean = %.3f ", mean); // Average IQR = (number[8]) - (number[2]); printf ("IQR= %.1f ", IQR); low_lim = number[2] - 1.5 * IQR ; up_lim = number[8] + 1.5 * IQR ; printf("low_limit is %.1f ", low_lim) ; printf("up_limit is %.1f ", up_lim);

for (int i = 0; i <11; ++i) { if ((number[i]> up_lim) || (number[i]300){ printf("Unfit for drinking"); }

return; }

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Database Driven Web Sites

Authors: Joline Morrison, Mike Morrison

2nd Edition

? 061906448X, 978-0619064488

More Books

Students also viewed these Databases questions

Question

What does Processing of an OLAP Cube accomplish?

Answered: 1 week ago