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
Why is it necessary to understand conflict of interest and how it could affect you at work​
Anastasy [175]

Answer:

Conflict of interest is a common issue in the workplace. Most of us have heard someone say, “It’s who you know, not what you know.” We have heard co-workers complain that a manager’s relative always gets the biggest raise or the best assignment. We might have seen colleagues accept gifts from potential vendors. Maybe a co-worker leaves work 20 minutes early every day so she can get to her second job. A supervisor may give a co-worker time off from work to do volunteer work or might allow employees to solicit donations and funds in the workplace, whether for the Girl Scouts or a local school function. Even though these situations are very different, they all fall under the heading of “conflict of interest.”

Explanation:are a clash that most often occurs between requirements and interests. Various types of conflicts of interest can occur because of the nature of relationships versus rules of organizations or federal and state laws. People can easily become biased (have an unfair preference) because of small things like friendship, food, or flattery, or they may be influenced to make a decision because of the potential to gain power, prestige, or money. Conflicts can occur when an individual makes or influences a decision and does so for some personal gain that may be unfair, unethical, or even illegal. The important part is what you do in each of those situations. Do you allow your family, friendship, financial, or inside knowledge affect your actions? If you do, you could be violating state statute and university policy.

In our work lives, we also have interests that could influence the way we do our jobs and the decisions we make. Even if we never act on them, there may be an appearance that a conflict of interest has influenced our decisions. Consider this example. Your supervisor is promoted to department director. His daughter-in-law is hired as a new supervisor within the college but is not reporting to him. Maybe the new supervisor is the best candidate for that position, and maybe the new department director had nothing to do with her hire. Even if this hire met all of the requirements under our Employment of Relatives policy, the situation appears suspicious and employees may think that something was unfair or unethical about her hire.

Transparency (being completely open and frank) becomes important when dealing with both actual and potentially perceived conflicts of interest. Perception happens when an individual observes something (behavior or activity) and comes to a conclusion. Perceiving a conflict of interest does not make it a conflict of interest. The true test of verifying whether a matter is just a potentially perceived conflict of interest, or an actual conflict of interest, is disclosure.

7 0
4 years ago
What are the advantages of using digital signals over analog signals? Scientist have found advantages when they convert digital
Viktor [21]

Answer:

Hope it Helps

Explanation:

Brainliest please

6 0
3 years ago
Read 2 more answers
Create a function, return type: char parameters: int *, int * Inside the function, ask for two integers. Set the user responses
iris [78.8K]

Answer and Explanation:

In C programming language:

char fun(int*a, int*b){

printf("enter two integers: ");

scanf("%d%d",a,b);

int e;

printf("please enter a character: ");

e=getchar();

return e;

}

int main(int argc, char *argv[]) {

int d;

int f;

int g;

fun();

printf("%d%d%d", d, f, g);

}

We have declared a function fun type char above and called it in main. Note how he use the getchar function in c which reads the next available character(after the user inputs with printf()) and returns it as an integer. We then return the variable e holding the integer value as char fun() return value.

4 0
3 years ago
given the numerical value 1010101.11, which of the following number systems is most likely represented.
nasty-shy [4]

Answer:

u have to give me more points

Explanation:

sorry

7 0
3 years ago
I WILL GIVE YOU BRAINIEST IF YOU GIVE A GOOD ANSWER
Elodia [21]

Answer:

5 Ways to Practice Green Computing

Buy "Energy Star" labeled monitors, desktops, laptops, and printers . ...

Put laptops in "sleep" mode when not in use. ...

Even better, turn OFF computers and other equipment when not in use. ...

E-cycle used computer equipment. ...

Buy the new "Smart Strip" power strip.

Explanation:

3 0
3 years ago
Other questions:
  • Damage to which portion of the limbic system results in loss of memory of recent events and difficulty committing anything new t
    13·1 answer
  • How Much Memory Did the First Computers Have?
    5·1 answer
  • Antivirus software products require that you update _____ on a regular basis
    8·2 answers
  • One major challenge in developing an international information system is to find​ a(n) ________ when there is so much cultural a
    11·1 answer
  • When would it be beneficial to make a copy of a document
    10·1 answer
  • Describe the effects technology, particularly computers, has had on mechanical labor.
    8·1 answer
  • What is the acronym DOS in full
    15·1 answer
  • During the preventive maintenance phase of a project involving a hydraulic power system, an engineer must change a gasket on a p
    14·1 answer
  • Computer operates nearly 100% accurately but why is the phrase'garbage in garbage out'(GIGO) associated with their use?Describe
    15·1 answer
  • A _____ model is one that is automatically adjusted based on changing relationships among variables.
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!