#include "stdio.h"
int main()
{
int tab[100];
int n;
int i;
int j;
int temp;
printf("masukan jumlah array = ");
scanf ("%d",&n);
for (i=0; i<n; i++)
{
printf("masukan bilangan ke ");
printf("%d = ",i+1);
scanf("%d",&tab[i]);
}
temp=0;
j=0;
while (j<n)
{
if (tab[j]-((tab[j]/2)*2)==0)
{
temp=temp+1;
j++;
}
else
{
j++;
}
}
printf("nilai genap banyaknya = ");
printf("%d",temp);
getch();
}
int main()
{
int tab[100];
int n;
int i;
int j;
int temp;
printf("masukan jumlah array = ");
scanf ("%d",&n);
for (i=0; i<n; i++)
{
printf("masukan bilangan ke ");
printf("%d = ",i+1);
scanf("%d",&tab[i]);
}
temp=0;
j=0;
while (j<n)
{
if (tab[j]-((tab[j]/2)*2)==0)
{
temp=temp+1;
j++;
}
else
{
j++;
}
}
printf("nilai genap banyaknya = ");
printf("%d",temp);
getch();
}
No comments:
Post a Comment