Randomly generates integers between 12 5~15 into a bunch of arrays, and then outputs these integers with 4 numbers per line
#include <stdio.h>
int main ()
{
int a[12],i,j;
for (i=0;i<11;i++)
scanf ("%d", &a[i]);
for (i=0;i<2;i++)
for (j=0;j<2;j++)
printf ("%d%d%d\n", a[i],a[i+1],a[i+2],a[i+3]);
}
Positive solution
#include <stdio.h>
Main ()
{
int a,i,j,n,b,s[120];
for (i=0;i<12;i++)
scanf ("%d", &s[i]);
for (i=0;i<12;i++)
{if (i%4==0)
printf ("\ n");
printf ("%d", s[i]);
}
return 0;
}
Use an array to find the average of the maximum minimum value of a set of numbers and how many more than the average
#include <stdio.h>
int main ()
{
int a[50],i,j,k=0,t,v,n;
scanf ("%d\n", &n);
for (i=0;i<n;i++)
scanf ("%d", &a[i]);
for (j=1;j<=n-1;j++)
{
for (i=0;i<=n-1;i++)
for (i=0;i<=n-j-1;i++)
if (a[i]>a[i+1])
{T=a[i];
A[I]=A[I+1];
a[i+1]=t;
}
}
for (i=0;i<n;i++)
T+=a[i];
v==t/(n);
for (i=0;i<n;i++)
{
if (V>a[i]);
}k+=1;
printf ("max=%d min=%d%d%d", a[i],a[0],v,k);
}
Positive solution
#include <stdio.h>
Main ()
{
int a=0,b,n,i,j,s[100],max,min,w;
scanf ("%d", &n);
w=0;
for (i=0;i<n;i++)
scanf ("%d", &s[i]);
Max=s[0];
for (i=1;i<n;i++)
if (Max<s[i])
Max=s[i];
else {max=s[i+1];min=s[i];}}
Min=s[0];
for (i=1;i<n;i++)
if (Min>s[0])
Min=s[i];
for (i=0;i<n;i++)
W=w+s[i];
w=w/n;
for (i=0;i<n;i++)
if (s[i]>w)
a++;
printf ("%d%d%d%d\n", max,min,w,a);
return 0;
}
2 questions are not correct, the method of seeking improvement