Question about Computers & Internet

1 Answer

C program leap year program

Posted by on

  • suraiya Sep 11, 2008

    i want the logic as well as code

  • Hitesh Thappa May 11, 2010

    HI

    can you plz put some more light on your question.

    What do you want the code or the logic.



    hitesh

    9923888524

×

1 Answer

  • Level 2:

    An expert who has achieved level 2 by getting 100 points

    MVP:

    An expert that gotĀ 5 achievements.

    Novelist:

    An expert who has written 50 answers of more than 400 characters.

    Governor:

    An expert whose answer gotĀ voted for 20 times.

  • Expert
  • 202 Answers

See the Following Program

Leap Years
Def: A year is a century year if it is divisible by 100.
Def: A year is a non-century year if it is not a century year.
Def: A year is a leap year if it is a non-century year that is divisible by 4, or a century year that is divisible by 400. Nothing else is a leap year.
In a source file named leapyears.cpp, write a program that will prompt the user for the starting year and ending year for a range of years and print to the screen all leap years in that range, 5 years per line. You must write a separate function called isLeapYear that takes a year as a parameter and returns whether or not that year is a leap year. Your main function will call the isLeapYear function in a loop for every year within the range delineated by, and including, the starting and ending years.
Help with Code Tags c Syntax (Toggle Plain Text)

  1. #include <iostream>
  2. using namespace std;
  3. bool LeapYear(int y)
  4. {
  5. return ( y % 4 == 0) && (y % 100 != 0) || (y % 400 == 0);
  6. }
  7. double isLeapYear(double x)
  8. {
  9. if( x > -10000 && x < 10000)
  10. return x;
  11. }
  12. int main()
  13. {
  14. int x;
  15. cout << "Please enter start and end of a range of years: ";
  16. cin >> x;
  17. if (isLeapYear(x))
  18. {
  19. if (LeapYear(x))
  20. cout << x;
  21. }
  22. }
--------------------------------------------------------------------------------------------------------------------------------------------------
The One More Sample Of the Program

C program to check whether a year is a leap year or not.

Code: C /*
** C program to check whether an entered year is a leap year or not
** @author: Pradeep
** @date: 02/12/06
*/


#include<stdio.h>

int main(void)
{
int year;

printf("Enter the year: ");
scanf("%d",&year);

/*
** The logic is that the year is either divisible by both
** 100 and 4 , OR its only divisible by 4 not by hundred
*/

if(year%400 ==0 || (year%100 != 0 && year%4 == 0))
{
printf("Year %d is a leap year",year);
}
else
{
printf("Year %d is not a leap year",year);
}

return 0;
}
If Not Satisfied Just put the Program name in Google and Search

Posted on Sep 12, 2008

1 Suggested Answer

6ya6ya
  • 2 Answers

SOURCE: I have freestanding Series 8 dishwasher. Lately during the filling cycle water hammer is occurring. How can this be resolved

Hi,
a 6ya expert can help you resolve that issue over the phone in a minute or two.
best thing about this new service is that you are never placed on hold and get to talk to real repairmen in the US.
the service is completely free and covers almost anything you can think of (from cars to computers, handyman, and even drones).
click here to download the app (for users in the US for now) and get all the help you need.
goodluck!

Posted on Jan 02, 2017

Add Your Answer

Uploading: 0%

my-video-file.mp4

Complete. Click "Add" to insert your video. Add

×

Loading...
Loading...

Related Questions:

1 Answer

WHEN was FIRST Leap-Year Recorded?


The National Maritime Museum has your answer: "The first leap year in the modern sense was 1752, when 11 days were 'lost' from the month September with the adoption of the Gregorian calendar by Britain and her colonies. After 1752 we adopted the system still in use today where an additional day is inserted in February in years wholly divisible by 4, other than years ending in 00 with the exception of those divisible by 400 which are still leap years (like 2000). This is certainly not the first use of leap years, the Julian calendar we used before 1752 had a simpler system of leap years, and remember, no calendar is universal."

Mar 07, 2017 | Watches

1 Answer

Has no leap yr. went from 2/28 to 3/1 cannot coordinate time


  • Auto Calendar (pre-programmed until the year 2039)
that means, you need to set up correct year in order to show leap years.... and then it will show you also correct day, after you will set it up correctly..... http://support.casio.com/storage/en/manual/pdf/EN/009/qw1545.pdf

check page 2

Mar 02, 2016 | Casio DW-5600E-1VCT Wrist Watch

1 Answer

How do you know witch setting to make on the leap year adjustment on the Citizen Calibre 8700 model. +1, +2, +3...?


On Leap Years, the function dial is to be set to '0'.
Add one for each year after...
So, for 2011, set the function dial to '3' since it has been 3 years since 2008, the last leap year. Next year it should move/be set to '0' again since 2012 is a leap year.

Dec 23, 2010 | Citizen Eco-Drive Calibre 8700 Wrist Watch

2 Answers

Need an expert on the new minute repeater by campanola, sold one at the retail jewelry store i work at, gentleman wants step-by-step hands on instruction as to the minute repeater function as well as the...


in order to set the repeater chime you need to set the watch and the sub watch to the same time.

This watch has comes with crown in position 0 , if you pull it out one level it becomes position 1 and if you pull it out one more time it is position 2 .

There are 3 buttons on the watch also. The button directly above the crown is button A the button below the crown is button B and the button directly across the crown is button C.

To set time you must first pull out crown to position 2 when the small second hand is at 12 o'clock position and it is stopped.

The mode will also at this time go to 0 and the sub watch second hand( the long second hand with the sun on it ) will also go to 0.

At this time you can just move the crown to set the proper time to the main watch . Now if you press the B button to set the sub watch . Each time you press the B button it will advance one minute hold down the B button and will advance time faster.

Do this to set the sub watch time make sure you watch the am and pm to make sure you are getting the proper time of day.

if the sub watch second hand ( the long second hand) is not aligned to 12 oclock then press the A button keep pressing button or hold it down to go faster until it is aligned at the 12 oclock position

Now push crown in back to 0 position for your time for your watch and sub watch should be set.

Set leap year.
Pull crown to position 1
Press the B button to adjust leap year.
the leap year is set by how many years from the previous leap year it has been . So 2008 was the previous leap year so we will h ave to set leap year at year 2 . The hands of the leap year are connected to the month so you must hold down a and b button or just press the b button to get to year 2 .

once you do that your leap year should be set.

to set the Repeater ( this is a beep from the watch to tell you the time with sound) make sure crown is in 0 position and hold a button for a couple of seconds to activate Reapter.

you can press any other button to end the chime .

also to get to leap year view while crown is in 0 position hold down the b button for 2 seconds . Pushes any button to return to normal calendar.

Oct 16, 2010 | Citizen Campanola Perpetual Calendar...

1 Answer

How can i determine the input number of a leap


Hello, Just divide the year by 4 and see check the remainder. If the remainder is 0 the year is leap year else it is a non leap year.
Regards, polysandy

Jul 17, 2010 | Sun Java Programming Language (cdj-275)

1 Answer

Dvd code for the little leaps game system


http://leapfrog.custhelp.com/cgi-bin/leapfrog.cfg/php/enduser/std_adp.php?p_faqid=1492&p_created=1157747309&p_sid=jy6ltQ*i&p_accessibility=0&p_redirect=&p_lva=&p_sp=cF9zcmNoPSZwX3NvcnRfYnk9JnBfZ3JpZHNvcnQ9JnBfcm93X2NudD0yODgsMjg4JnBfcHJvZHM9JnBfY2F0cz0mcF9wdj0mcF9jdj0mcF9zZWFyY2hfdHlwZT1hbnN3ZXJzLnNlYXJjaF9ubCZwX3BhZ2U9MQ**&p_li=&p_topview=1

Apr 09, 2008 | Televison & Video

1 Answer

Leap Year


you cant. it has to be manualy changed

Feb 29, 2008 | AT&T Lucent MLS-12D Phone

1 Answer

Setting the perpetual callender 8700


The year is now 2008 a leap year. You should set the watch to leap year.

Nov 02, 2007 | Citizen 8700 BL8000-54L Wrist Watch

Not finding what you are looking for?
Computers & Internet Logo

Related Topics:

155 people viewed this question

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers

kakima

Level 3 Expert

102366 Answers

David Payne
David Payne

Level 3 Expert

14161 Answers

Are you a Computer and Internet Expert? Answer questions, earn points and help others

Answer questions

Manuals & User Guides

Loading...