Current location - Plastic Surgery and Aesthetics Network - Plastic surgery and beauty - Random number shaping
Random number shaping
As the name implies, you only need to calculate the sum result:

# include & ltstdlib.h & gt

# include & ltstdio.h & gt

# include & lttime.h & gt

int main()

{

int n= 10,i= 1,count = 0;

srand(time(0));

for(; I & ltn;; i++)

{

int m;

if((m = rand()% 100+ 1)& amp; 1)= = 0)/* x & amp; 1==0 means it is even */

{

count+= m;

}

}

printf("%d\n ",count);

getchar();

}