i was trying to count the number of multiples of 2, 3, and 6 respectielly from the users input file. but for some reason, my counter is not working. can any bosy hep me please. my code:
#include <stdio.h>
int main (void)
{
int num[12];
int i;
int counttwo;
int countthree;
int countsix;
int total=0;
printf("enter 12 integer numbers:\n");
for(i=0;i<12;i++){
scanf("%d", &num[i]);
}
for(i=0;i<12;i++){
counttwo=0;
if(num[i]%2==0){
counttwo++;
}
countthree=0;
if(num[i]%3==0)
{
countthree++;
}
countsix=0;
if(num[i]%6==0)
{
countsix++;
}
printf("There are %d multiples of 2:\n", counttwo);
printf("There are %d multiples of 3:\n", countthree);
printf("There are %d multiples of 6:\n", countsix);
}
return 0;
}