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

Reinstall windows 7 programs


So you decided not to jump from Windows XP to Windows VISTA. but now you're ready to LEAP forward into Windows 7.

First, you will want to BACKUP ALL of your programs.

Since you did not upgrade to VISTA, you will LOOSE all of your programs when you upgrade to Windows 7, so be sure to backup all of your programs and files.


If you wish, you can use an external hard drive and a program called WINDOWS EASY TRANSFER to make this task easier.


See the link below for this FREE program.


http://www.microsoft.com/downloads/details.aspx?FamilyID=2b6f1631-973a-45c7-a4ec-4928fa173266&DisplayLang=en


Now, for the fun part! Insert the Windows 7 disc into the computer and start or restart the computer.


Follow the onscreen instructions to completely install Windows 7.


You will now need to reinstall each of your programs.


If you used Windows Easy Transfer, you can use the list of programs that it prints out to be certain that you reinstall all of your programs.


Hope this helps.

Dec 01, 2012 | Microsoft Windows XP Home Edition

2 Answers

If you bye your internet security disc do you have to bye one every year


yes.
the cost of internet security and anti-viruses is for 1 year after which their licence expires.

if you don't want to buy every year you have to buy a 2 year or 3 year licence , which is not a wise step.

May 20, 2011 | Computers & Internet

1 Answer

I have Microsoft Office 2007 which I purchased from Dell and installed late last year or earlier this year, however, the Excel keeps getting lost and I cannot open documents which I have done or received...


Use http://www.magicaljellybean.com/keyfinder/ to find the serial number. As for the corrupt Excel program, you may need to determine what exactly is the problem there.

Go to Start, All Programs, Microsoft Office and see if Excel is listed. If it is, then click on it to launch it. Does it open? If so, then go to where your excel spreadsheets are saved to (e.g. My Documents) then right click an Excel spreadsheet & click on "Open With". Select Choose Program. Select the Microsoft Excel. If Excel is not listed, click the browse button and browse to C:\Program Files\Microsoft Office\Office12. Click the Always use the selected program to open this type of file checkbox. Click OK

Nov 26, 2010 | Microsoft Windows XP Professional

1 Answer

How to install free leap office software


when try to open leap office , then not open,so status shown orphan

Aug 15, 2010 | Computers & Internet

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

Related Topics:

153 people viewed this question

Ask a Question

Usually answered in minutes!

Top Computers & Internet Experts

Brian Sullivan
Brian Sullivan

Level 3 Expert

27725 Answers

joecoolvette
joecoolvette

Level 3 Expert

5660 Answers

kakima

Level 3 Expert

98694 Answers

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

Answer questions

Manuals & User Guides

Loading...