Kod:
/*kullaným:

negunu 4 Mart 1964
Carsamba

negunu 12 9 2008
Cuma */


/*** negunu.c  ******/

#include <stdio.h>
#include <stdlib.h>
#include <ctype.h>
#include <string.h>

#define isleap(y)   ((y) % 4 == 0 && (y) % 100 != 0 || (y) % 400 == 0)

int dayofweek(int d, int m, int y)
{
   static int t[] = {0, 3, 2, 5, 0, 3, 5, 1, 4, 6, 2, 4};
   
   y -= m < 3;
   
   return (y + y / 4 - y / 100 + y / 400 + t[m - 1] + d) % 7;
}



int main(int argc, char **argv)
{
   int day, mon, year;
   static const char *days[] = {"Pazar", "Pazartesi", "Sali", "Carsamba", "Persembe", "Cuma", "Cumartesi"};
   static const char *mons[] = {"Ocak", "Subat", "Mart", "Nisan", "Mayis", "Haziran", "Temmuz",
      "Agustos",    "Eylul", "Ekim", "Kasim", "Aralik"};
   int daytabs[] = {0, 31, 28, 31, 30, 31, 30, 31, 31, 30, 31, 30, 31}; 


   if (argc != 4) {
      fprintf(stderr, "<negunu> <gg> <aa> <yyyy>\n");
      return 1;
   }

   day = atoi(argv[1]);

   if (day < 1 || day > 31) {
      fprintf(stderr, "gecersiz bir gun degeri girdiniz!\n");
      return 2;
   }

   if (isdigit(*argv[2])) 
      mon = atoi(argv[2]);
   else {
      int k;
      for (k = 0; k < 12; ++k)
         if (!stricmp(mons[k], argv[2]))
            break;
      if (k < 12)
         mon = k + 1;
      else
         mon = 0;
   }

   if (mon < 1 || mon > 12) {
      fprintf(stderr, "gecersiz bir ay degeri girdiniz!\n");
      return 3;
   }

   year = atoi(argv[3]);

   if (year <= 0) {
      fprintf(stderr, "gecersiz bir yil degeri girdiniz!\n");
      return 4;
   }

   if (isleap(year))
      daytabs[2] = 29;

   if (day > daytabs[mon]) {
      fprintf(stderr, "gecersiz bir gun degeri girdiniz!\n");
      return 5;
   }

   fprintf(stdout, "%s\n", days[dayofweek(day, mon, year)]);

   return 0;
}