#include <stdlib.h>
#include <stdio.h>
#define N 10
double fun(double x[],double *y)
{ int i,j; double av;
/found/
av=0.0;
/found/
for(i=0; i<N; i++)
av=av+x[i]/N;
for(i=j=0; i<N; i++)
/found/
if(x[i]>av) y[j++]= x[i];
y[j]=-1;
return av;
}
void main()
{ int i; double x[N],y[N];
for(i=0; i<N; i++){ x[i]=rand()%50; printf("%4.0f “,x[i]);}
printf(”\n");
printf("\nThe average is: %f\n",fun(x,y));
for(i=0; y[i]>=0; i++) printf("%5.1f “,y[i]);
printf(”\n");
}
#include <stdlib.h>
#include <conio.h>
#include <stdio.h>
/found*/
double fun (int m)
{ double y=0, d;
int i;
/found*/
for(i=100;i<=m;i+=100)
{d=(double)i*(double)i;
y+=1.0/d;
}
return(y);
}
void main()
{ int n=2000;
system(“CLS”);
printf("\nThe result is %1f\n",fun(n));
}
#include<stdio.h>
#include<string.h>
#include<conio.h>
#include<stdlib.h>
#define N 10
typedef struct ss
{ char num[10];
int s;
} STU;
void fun(STU a[], STU s)
{
int i,min=a[0].s;
for(i=0;i<N;i++)
if(min>a[i].s)
{
min=a[i].s;
s=a[i];
}
}
void main()
{
FILE wf;
STU a[N]={{ “A01”,81},{ “A02”,89},{ “A03”,66},{ “A04”,87},{ “A05”,77},
{ “A06”,90},{ “A07”,79},{ “A08”,61},{ “A09”,80},{ “A10”,71}},m;
int i;
system(“CLS”);
printf(“The original data\n”);
for(i=0;i<N;i++)
printf(“No=%s Mark=%d\n”, a[i].num,a[i].s);
fun(a,&m);
printf(“THE RESULT\n”);
printf(“The lowest :%s, %d\n”,m.num,m.s);
//
wf=fopen(“out.dat”,“w”);
fprintf(wf,"%s, %d",m.num,m.s);
fclose(wf);
/**/
}