Đề: Biết ngày ngày 1/10/2018 là thứ hai (Monday). Viết chương trình nhập vào ngày ?(1 ≤ ? ≤ 31) của tháng 10 năm 2018. Xuất ra màn hình cho biết thứ của ngày ?/10/2018 ở dạng tiếng Anh. "giúp với" lập trình pascal

2 câu trả lời

uses crt;

var n,x: byte;

Begin

  readln(n);

  x:= (n-1) mod 7;

  if x=0 then write('MONDAY');

  if x=1 then write('TUESDAY');

  if x=2 then write('WEDNESDAY');

  if x=3 then write('THURSDAY');

  if x=4 then write('FRIDAY');

  if x=5 then write('SATURDAY');

  if x=6 then write('SUNDAY');

  readln;

End.

uses crt;
var d:longint;
begin
clrscr;
   write('d=');readln(d);
   if d mod 7=1 then writeln('Monday');
   if d mod 7=2 then writeln('Tuesday');
   if d mod 7=3 then writeln('Wednesday');
   if d mod 7=4 then writeln('Thursday');
   if d mod 7=5 then writeln('Friday');
   if d mod 7=6 then writeln('Saturday');
   if d mod 7=0 then writeln('Sunday');
readln;
end.

Câu hỏi trong lớp Xem thêm