#include <iostream>
#include <string>
usingnamespace std;
int main()
{
int year, month, day, h;
cout << "Enter a year from the Gregorian Calendar: ";
cin >> year;
cout << "Enter a month from the Gregorian Calendar: ";
cin >> month;
cout << "Enter a day from the Gregorian Calendar: ";
cin >> day;
h = (day + (13 * (month + 1) / 5) + (year) + (year / 4) - (year / 100) + (year / 400) % 7);
cout << h << endl;
return 0;
}
#include <iostream>
#include <string>
usingnamespace std;
int main()
{
int year, month, day, h;
cout << "Enter a year from the Gregorian Calendar: ";
cin >> year;
cout << "Enter a month from the Gregorian Calendar: ";
cin >> month;
cout << "Enter a day from the Gregorian Calendar: ";
cin >> day;
h = (day + (13 * (month + 1) / 5) + (year) + (year / 4) - (year / 100) + (year / 400)) % 7;
if (h == 1)
{
cout << "The day is Sunday.";
}
if (h == 2)
{
cout << "The day is Monday.";
}
if (h == 3)
{
cout << "The day is Tuesday.";
}
if (h == 4)
{
cout << "The day is Wednesday.";
}
if (h == 5)
{
cout << "The day is Thursday.";
}
if (h == 6)
{
cout << "The day is Friday.";
}
if (h == 7)
{
cout << "The day is Saturday.";
}
return 0;
}