1answer.
Ask question
Login Signup
Ask question
All categories
  • English
  • Mathematics
  • Social Studies
  • Business
  • History
  • Health
  • Geography
  • Biology
  • Physics
  • Chemistry
  • Computers and Technology
  • Arts
  • World Languages
  • Spanish
  • French
  • German
  • Advanced Placement (AP)
  • SAT
  • Medicine
  • Law
  • Engineering
balandron [24]
3 years ago
9

6.31 LAB: Leap year - functions A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer

to rotate around the sun. To account for the difference in time, every 4 years, a leap year takes place. A leap year is when a year has 366 days: An extra day, February 29th. The requirements for a given year to be a leap year are: 1) The year must be divisible by 4 2) If the year is a century year (1700, 1800, etc.), the year must be evenly divisible by 400 Some example leap years are 1600, 1712, and 2016. Write a program that takes in a year and determines whether that year is a leap year. Ex: If the input is:
Computers and Technology
2 answers:
Gnesinka [82]3 years ago
7 0

Answer:

The code is given below in C with appropriate comments

Explanation:

#include <stdio.h>

#include <stdbool.h>

bool ISLeapYear(int userYear)

{

  // If a year is multiple of 400,

  // then it is a leap year

  if (userYear % 400 == 0)

      return true;

  // Else If a year is multiple of 100,

  // then it is not a leap year

  if (userYear % 100 == 0)

      return false;

  // Else If a year is multiple of 4,

  // then it is a leap year

  if (userYear % 4 == 0)

      return true;

  return false;

}

int main(void) {

  int year;

  printf("Enter year : ");

  scanf("%d",&year);

  if(ISLeapYear(year)){

      printf("%d is a leap year.",year);

  }else{

      printf("%d is not a leap year.",year);

  }

  return 0;

satela [25.4K]3 years ago
4 0

Answer:

#include <iostream>

using namespace std;

int main()

{

   int detect_year;

   cout << "Enter a year to find whether its leap year or not: ";

   cin >> detect_year;

   if (detect_year % 4 == 0)

   {

       if (detect_year % 100 == 0)

       {

           if (detect_year % 400 == 0)

               cout << "The year you entered "<< detect_year << " is a leap year.";

           else

               cout << "The year you entered "<<detect_year<< " is not a leap year.";

       }

       else

           cout << "The year you entered "<< detect_year << " is a leap year.";

   }

   else

       cout << "The year you entered "<<detect_year<<" is not a leap year.";

   return 0;

}

Explanation:

first make a variable named as detect_year of time integer. The using cin ask the user to enter any year to find out whether its leap year or not. Once the user has entered the year the value is stored in detect_year variable. After the divide the year by 4 if the remainder is not zero then it is not a leap year. If it is divisible by 4 which means the remainder is zero the divide the year by 100. If the remainder is not zero means it is not divisible by 100 then its a leap year. If it is divisible by 100 then check whether the year is divisible by 400 if yes then it is leap year other wise it is not.

You might be interested in
What role does the automated surface observing system.
Ilya [14]

Answer: The ASOS systems serves as the nation's primary surface weather observing network. ASOS is designed to support weather forecast activities and aviation operations

6 0
2 years ago
Read 2 more answers
What are the two compatibility issues that may arise between computer systems while transferring presentations? different video
Mamont248 [21]

Different video files and operating system versions can cause compatibility issues to arise between computer systems.

Since, file formats and operating systems may not be compatible with each other. For example, earlier versions of Windows may not be able to play certain types of video files due to the codecs used to encode them.

<h3>Importance of compatibility between operating system computer systems</h3>

Compatibility between operating systems is important because it allows different computer systems to interact and share resources. This includes sharing of programs, files, and data.

Compatibility also allows users to access applications and services on different platforms. It also enables efficient use of hardware and software resources, as well as efficient use of resources in a network. Compatibility also ensures that computer systems can communicate with each other and can access the same resources. Without compatibility, it would be difficult for computer systems to interact with each other.

What are two compatibility issues that may arise between computer systems while transferring presentations? (Fill in the blank).

Different video files and _____ can cause compatibility issues to arise between computer systems.

Learn more about Compatibility between operating systems:

brainly.com/question/24760752

#SPJ4

4 0
1 year ago
What is an effective way to record change management? (5 points)
yanalaym [24]

Answer:

Detailed Notes

Explanation:

I took the 2.04 quiz

3 0
4 years ago
Carl wants to add two new characters to the extraterrestrial battleship game he's
nikitadnepr [17]

The option that  best explains the game is that a game can have multiple instances using the same class.

<h3>Can a class have multiple instances?</h3>

A game is one that can always create multiple instances of a class. This is known to be the reason that classes are made.

Conclusively,  each object often has its  own specific inner variables and they do not have only if they are static but games of multiple instances is the reason why there is only one class with the new characters.

Learn more about Games from

brainly.com/question/1786465

6 0
3 years ago
The _______ number system allows digital devices to represent virtually any number simply by using 0s and 1s.â
zhuklara [117]
The answer is <span>Digital data 

</span>
4 0
3 years ago
Other questions:
  • When saving a memo you created in Word, which of the following extensions is automatically assigned to the document?
    8·2 answers
  • What kind of game was Pole Position?
    14·1 answer
  • Dialogue is not a characteristic of functional text because...
    12·1 answer
  • Advantages of purchasing a software package over developing software in-house include all of the following except ____. Group of
    13·1 answer
  • Kelvin owns a small trading firm. Recently, he suspected that some of his employees were using fraudulent activities for their p
    5·2 answers
  • Bill Schultz works at a high power investment firm in Los Angeles. Bill is responsible for promoting the firm's vision and creat
    15·1 answer
  • Why is compression a "hard problem" for computers? Draw on your own experience compressing text with the text compression widget
    12·1 answer
  • How can you say that a painting is real? ​
    7·2 answers
  • Mobile apps are replacing the old__________<br><br>​
    7·2 answers
  • LaShawn would like to post photos in a social media app, but the program needs to be modified in order to display a greater vari
    12·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!