#include <stdio.h>
#include <stdlib.h>
#include <time.h>
int total=0,i,h;
int x[21];
int countEven(int*a, int len){
srand( time( NULL ) );
for(i=0;i<20;i++){
x[i]=rand()%1000;
printf("%4d",x[i]);
}
*a=x[0];
while(*a++){
if(*a%2==0) {
total++;
}
}
return total;
}
int main( void ){
countEven(x,20);
printf("There are %d even integers in the data.\n",total);
return 0;
}
//這題檸檬想了好久,堅持下去果然就成功了
//題目來源:c how to program
//程式均為自創,如有雷同純屬巧合
全站熱搜
留言列表