#include
int main()
{
int a[30];
int b[6];
int i,s=0;
for(i=0;i<30;i++)
{
a[i]=2*(i+1);
s+=a[i];
if(i%5==4)
{
b[i/5]=s/5;
s=0;
}
}
for(i=0;i<6;i++)
printf("%d ",b[i]);
}
#include
int main()
{
int num[30];
int j = 2;
int i;
int k;
int n;
int sumArr[5];
for(i = 0; i < 30; i++)
{
num[i] = j;
j += 2;
}
for(i = 0, n = 0; i < 30; n++)
{
int sum = 0;
for(k = i; k < i + 5; k++)
{
sum += num[k];
}
sumArr[n] = sum/5;
i += 5;
}
for(i = 0; i < 5; i++)
{
printf("%d\n", sumArr[i]);
}
return 0;
}
#include
int main()
{
int first[30] = {0};
int second[10] = {0};
int i=0, j = 0;
int count = 0, temp = 0;
for( i=0; i<30; i++ )
{
first[i] += 2*(i+1);
count++;
temp += first[i];
if( count == 5 )
{
count = 0;
second[j] = temp/5;
temp = 0;
j++;
}
}
for( i=0; i<30; i++ )
{
printf( "%d\t", first[i] );
}
printf( "\n" );
for( i=0; i
printf( "%d\t", second[i] );
}
printf( "\n" );
return 0;
}