Click here to Skip to main content
15,905,504 members

Comments by Ryan Nair (Top 1 by date)

Ryan Nair 5-Sep-10 11:25am View    
Sir, I have tried you're suggestion. But everytime i'm running the program. The set of code is always the same:

My code is like this:

const char col[]={'R','Y','BG','B','P','G'}; /*in the declaration area*/

for(i=0;i<6;i++) //IN THE
{
int r=rand()%sizeof(col); MAIN
printf("%c ",col[r]);
}
printf("
"); AREA//


THE OUTPUT IS ALWAYS: P P B P P Y

How to randomize it every time I would run the program?
Hope you can answer me back. Thanks.