Answered step by step
Verified Expert Solution
Link Copied!

Question

1 Approved Answer

Can someone help me write a program for this in c? From Project Euler, Counting Sundays: You are given the following information, but you may

Can someone help me write a program for this in c? image text in transcribed
From Project Euler, Counting Sundays: You are given the following information, but you may prefer to do some research for yourself 1 Jan 1900 was a Monday. Thirty days has September, April, June and November A1l the rest have thirty-one, Saving February alone, Which has twenty-eight, rain or shine And on leap years, twenty-nine. A leap year occurs on any year evenly divisible by 4, but not on a century unless it is divisible by 400 How many Sundays fell on the first of the month during the twentieth century (1 Jan 1901 to 31 Dec 2000)? And no 1/1/1901 is not a typo. Name your source code sundays.c. Capture the output in a script file named sundays.script Some hints: 1. You can use the cal command to display the calendar any year, e.g. S cal 1900 2. There is a reason they say 1 Jan 1900 falls on a Monday 3. You can determine if a year is a leap year by using the following: if (year % 4 -0 && year % 100 ! 0) | | year % 400- 0) /leap year / else /*not a leap year */ 4. As a way to get started: manually figure out, using cal, how many Sundays fell on the first of the month between 1901 and 1905 and write a program to solve that. After that program works correctly extend it to the year 2000

Step by Step Solution

There are 3 Steps involved in it

Step: 1

blur-text-image

Get Instant Access to Expert-Tailored Solutions

See step-by-step solutions with expert insights and AI powered tools for academic success

Step: 2

blur-text-image

Step: 3

blur-text-image

Ace Your Homework with AI

Get the answers you need in no time with our AI-driven, step-by-step assistance

Get Started

Recommended Textbook for

Focus On Geodatabases In ArcGIS Pro

Authors: David W. Allen

1st Edition

1589484452, 978-1589484450

More Books

Students also viewed these Databases questions

Question

Define GDSS and list the limitations of the initial GDSS software.

Answered: 1 week ago

Question

Understanding Groups

Answered: 1 week ago