Write a C program to enter the elements of three one dimensional array A (size 5), B (size 10) and C (size 5) as an input from the keyboard. The program will find and print:
•
The maximum element of array A entered as an input.
•
The minimum element of array B entered as an input.
•
Total number of negative numbers divisible by 3 in array C and B entered as an input.
This is the question, i managed to do the first two parts, but not the last one.
I tried doing it but i think my code has a problem
The Program
#include <stdio.h>
#include <conio.h>
void main ()
{
int max;
int A[5];
int i;
int j;
int B[10];
int C[5];
int min;
int k;
int count1=0;
for(i=1;i<=5;i++)
{
printf("\nEnter Element A : ");
scanf("%d",&A[i]);
}
max=A[0];
for(i=1;i<=5;i++)
{
if(max<A[i])
{
max=A[i];
}
}
printf("\nMax in Array A is Equal to : %d",max);
printf("\n-----------------");
for(j=1;j<=10;j++)
{
printf("\nEnter Element B : ");
scanf("%d",&B[j]);
}
min=B[0];
for(j=1;j<=10;j++)
{
if(min>B[j])
{
min=B[j];
}
}
printf("\nMin in Array B is Equal to : %d",min);
printf("\n-----------------");
for(k=1;k<=5;k++)
{
printf("\nEnter Element C : ");
scanf("%d",&C[k]);
}
if(C[k] && B[j]<0 && C[k] && B[j]%3==0)
{
count1++ ;
}
printf("\nTotal negative number in Array B and C : %d",count1);
getche();
}
Please consider the bold part.
Thanks