Mega Code Archive

 
Categories / C / Math
 

A random thought for the day

#include <stdio.h> #include <time.h> #include <stdlib.h> void main() {   char thoughts[][50] = {"W",                          "A",                          "M",                          "T",                          "A",                          "A"};     srand((unsigned int)time(NULL));   printf("Today's thought is:\n%s\n", thoughts[rand()%(sizeof thoughts/sizeof thoughts[0])]); }