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
kakasveta [241]
3 years ago
15

3.26 LAB: Leap Year A year in the modern Gregorian Calendar consists of 365 days. In reality, the earth takes longer to rotate a

round 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: 1712 the output is: 1712 is a leap year. Ex: If the input is: 1913 the output is: 1913 is not a leap year.
Computers and Technology
2 answers:
Taya2010 [7]3 years ago
6 0

Answer:

// program in C++ to check leap year.

// include header

#include<iostream>

using namespace std;

// main function

int main() {

// variable

  int inp_year ;

  // ask user to enter year

  cout<<"Enter year:";

  // read year

  cin>>inp_year;

  // check year is leap or not

  if (((inp_year % 4 == 0) && (inp_year % 100 != 0)) || (inp_year % 400 == 0))

  // if leap year , print leap year

     cout<<inp_year<<" is a leap year.";

  else

  // print not leap year

     cout<<inp_year<<" is not a leap year.";

  return 0;

}

Explanation:

Read year from user.Then check if year is divisible by 4 and not divisible by 100 or year is divisible by 400 then year is leap year.otherwise year is not  leap year.

Output:

Enter year:1712                                                                                                            

1712 is a leap year.

Lera25 [3.4K]3 years ago
5 0

Answer:

#include <iostream>

using namespace std;

int main() {

  int inputYear;

 cin>>inputYear;

 // check year is leap or not

 if (((inputYear % 4 == 0) && (inputYear % 100 != 0)) || (inputYear % 400 == 0))

 // if leap year , print leap year

    cout<<inputYear<<" - leap year" << endl;

 else

 // print not leap year

    cout<<inputYear<<" - not a leap year" << endl;

 

  /* Type your code here. */

  return 0;

}

Explanation:

You might be interested in
What are the three main sub-sectors in the IT-BPM industry?<br>IT class 9​
sergeinik [125]

Answer:

Business Process Managment.

Software Products.

Engineering Research and Development

8 0
3 years ago
How to post a answer
SSSSS [86.1K]
………………….yes yes yes
6 0
3 years ago
Which of the following statements contains an error?
ASHA 777 [7]
I. is syntactically correct if genderString exists. if genderString, for example, is "Male", then char gender would be the character at index 0 (the first character), meaning 'M'.

II. is incorrect. It is using the comparison operator (==) instead of the assignment operator (=). It is also setting a boolean variable to a String value of 'F'. Boolean values cannot hold string values, and can only hold true & false. 

III. is correct if ageString only contains numbers (presumably, it does, as it's called ageString). Integer.parseInt is a function that converts String values to integer values if the string values only contain numerical characters.

The answer in this case should be B. II only.
5 0
3 years ago
Can race condition happen in monolithic memcached. <br><br> a. True <br> b. False
erica [24]

Answer:

True

Explanation:

It is TRUE that race condition happens in monolithic Memcached. This is evident in that in a python language, where Memcached "gets" and "set" function tends to turn to a race condition if for example the two functions are used together to accomplish similar things like locking given that it is not atomic.

Hence, in this case, the correct answer is TRUE

8 0
3 years ago
A certain program takes 26.67 seconds to run on 3 processors and 16 s to run on 7 processors. Find the execution time on one pro
brilliants [131]

Answer:

The explanation for the question is listed in the section below on Explanation.

Explanation:

The time needed for a program to execute in 26.67 seconds on 3 processors. Time expected to run the program, therefore, should be as follows:

The time to run on one processor = \frac{26.67}{3} = 8.89 seconds.

The time needed for a program to execute in 26.67 seconds on 7 processors, should be:

Time = \frac{16}{7} = 2.2857 seconds.

Whenever the amount of processors increases the performance or speed should increase.

The time is taken in percentage = \frac{26.67}{16}×100% = 170 %

As the number of processors increases from 3 to 7, the time required according to each processor increases by 70%.

In one processor the execution time should be as follows:

26.67+(26.67×0.7) = 45.339

                              = 45 seconds

Therefore. the execution period for a single processor is about 45 seconds.

The work is performed in parallel, whereas the program is already being parallelized. The overall function ought to be shared between the processor. The time is shortened to around half. Hence the duration taken will be 8 seconds after parallelization.

Theoretical execution time would be Tp > T infinity.

Thus, T infinity<45

The theoretical processing interval on processor count P1/2 would therefore be less than 8 seconds. Because, the time required during parallelization was just that.

5 0
3 years ago
Other questions:
  • Which type of cable is described as a central conductor wire that is surrounded by insulating materials and placed inside a brai
    13·1 answer
  • Fill in the blank.
    7·1 answer
  • Which WAN technology is designed to work with a variety of commonly used layer-2 protocols and is sometimes called a layer-2.5 t
    15·1 answer
  • Yolanda first breaks down the whole game she needs to program into modules. She then breaks these modules into smaller modules u
    11·1 answer
  • MULTIPLE CHOICE:
    15·1 answer
  • Select all the sets that are countably infinite. Question 3 options: the set of real numbers between 0.1 and 0.2 the set of all
    12·1 answer
  • How to be fluent in computer
    10·2 answers
  • What is the purpose of using variables in programming?
    11·1 answer
  • PLEASE I NEED HELP FAST
    8·1 answer
  • If a user wants to change one small section of the formatting of a document and leave the rest the same, which
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!