0

okay, here is the code my teacher gave...but i do not understand some part...

```
#include <stdio.h>
#include <time.h>
#include <stdlib.h>
void printfAll(int size, int ary[])
{
int a;
for(a=0; a< size; a++)
{
if(!(a%10)) //why a%10 and what not equal to it//
printf("\n");
printf("%5d", ary[a]);
}
printf("\n");
}
void printOddIdx(int size, int ary[])
{
int a;
for(a=1; a<size; a+=2)
{
if(!((a-1)%20))
printf("\n");
printf("%5d", ary[a]);
}
printf("\n");
}
void printfOdd(int size, int ary[]) // print the odd values
{
int a, num=0, newline =0;
for(a=1; a< size; a++)
{
if(!(num%10)&& !newline)
{
printf("\n");
newline=1;
}
if(ary[a]%2)
{
if(newline)
newline=0;
printf("%5d", ary[a]);
num++;
}
}
}
long sum (int size, int ary[])
{
int a;
long sum=0;
for(a=0; a<size; a++)
sum += ary[a];
return sum;
}
int largest (int size, int ary[])
{
int a, large_index=0;
for(a=0; a<size; a++)
if(ary[a] > ary[large_index])
large_index=a;
return large_index;
}
void getNegatives(int ary[])
{
int a, b, negAry[100];
for(b=0, a=0; a<100; a++)
{
if(ary[a]<0)
{
negAry[b]=ary[a];
b++;
}
}
printf("\n\n---random number is divisible by 3 or 7, is stored as negative number---\n");
printfAll(b, negAry);
}
main()
{
int aryA[100], i;
srand(time(NULL));
for (i=0; i<100; i++)
{
aryA[i] = rand()%999+1;
if((aryA[i]%3 ==0)|| (aryA[i]%7 ==0))
aryA[i]=-aryA[i];
}
printf("\n\n---Prac 2a.Print the array 10 values to a line---\n");
printfAll(100, aryA);
printf("\n\n---Prac 2b.Odd numberred index location, ten to a line---\n");
printOddIdx(100, aryA);
printf("\n\nPrac 2c.Sum of array %ld\n", sum(100, aryA));
printf("\n\nPrac 2d.Largest index of array is = %d\n", largest(100, aryA));
getNegatives(aryA);
}
```