fork(39) download
  1. Program jour_semaine;
  2. Var day, month, year, dayyear, daymonth, weekday, cm:integer;
  3. jj:string;
  4. Begin
  5. Writeln ('Donner le jour');
  6. Readln (day);
  7. Writeln ('Donner le mois');
  8. Readln (month);
  9. Writeln ('Donner l''année');
  10. Readln (year);
  11. dayyear:=(year-1)*365 + ((year-1) div 4);
  12. daymonth:=0;
  13. For cm:=1 To (month-1) Do Case cm Of
  14. 1, 3, 5, 7, 8, 10, 12 : daymonth:=daymonth+31;
  15. 4, 6, 9, 11 : daymonth:=daymonth+30;
  16. 2 : If (year mod 4=0) and ((year mod 100<>0) or (year mod 400 =0)) Then daymonth:=daymonth+29
  17. Else daymonth:=daymonth+28;
  18. End;
  19. weekday:=(dayyear+daymonth+day) mod 7;
  20. Case weekday Of
  21. 0:jj:='Dimanche';
  22. 1:jj:='Lundi';
  23. 2:jj:='Mardi';
  24. 3:jj:='Mercredi';
  25. 4:jj:='Jeudi';
  26. 5:jj:='Vendredi';
  27. 6:jj:='Samedi';
  28. End;
  29. writeln ('Le jour correspondant est ', jj);
  30. End.
Success #stdin #stdout 0s 288KB
stdin
05
12
2015
stdout
Donner le jour
Donner le mois
Donner l'année
Le jour correspondant est Samedi