answer.
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
Pachacha [2.7K]
1 year ago
5

#A year is considered a leap year if it abides by the #following rules: # # - Every 4th year IS a leap year, EXCEPT... # - Every

100th year is NOT a leap year, EXCEPT... # - Every 400th year IS a leap year. # #This starts at year 0. For example: # # - 1993 is not a leap year because it is not a multiple of 4. # - 1996 is a leap year because it is a multiple of 4. # - 1900 is not a leap year because it is a multiple of 100, # even though it is a multiple of 4. # - 2000 is a leap year because it is a multiple of 400, # even though it is a multiple of 100. # #Write a function called is_leap_year. is_leap_year should #take one parameter: year, an integer. It should return the #boolean True if that year is a leap year, the boolean False #if it is not. #Write your function here!

Computers and Technology
1 answer:
lara [203]1 year ago
5 0

Answer:

To check if the year comes under each 100th year, lets check if the remainder when dividing with 100 is 0 or not.

Similarly check for 400th year and multiple 0f 4. The following C program describes the function.

#include<stdio.h>

#include<stdbool.h>

bool is_leap_year(int year);

void main()

{

int y;

bool b;

 

printf("Enter the year in yyyy format: e.g. 1999 \n");

scanf("%d", &y);     // taking the input year in yyyy format.

 

b= is_leap_year(y);  //calling the function and returning the output to b

if(b==true)

{

 printf("Thae given year is a leap year \n");

}

else

{

 printf("The given year is not a leap year \n");

}

}

bool is_leap_year(int year)

{

if(year%100==0)   //every 100th year

{

 if(year%400==0)   //every 400th year

 {

  return true;

 }

 else

 {

  return false;

 }

}

if(year%4==0)  //is a multiple of 4

{

 return true;

}

else

{

 return false;

}

}

Explanation:

Output is given as image

You might be interested in
If the computer has an encrypted drive, a ____ acquisition is done if the password or passphrase is available. a. passive b. sta
Aleonysh [2.5K]

Answer: C. Live

Explanation:

A live acquisition is where data is retrieved from a digital device directly via its normal interface such as activating a computer and initiating executables. Doing so has a certain level of risk because data is highly likely to be modified by the operating system. The process becomes significantly more common likely with less available disk space to the point of completely impractical to image.

7 0
1 year ago
Program MATH_SCORES: Your math instructor gives three tests worth 50 points each. You can drop one of the test scores. The final
Simora [160]

Answer:

import java.util.Scanner;

public class num5 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       //Prompt and receive the three Scores

       int score1;

       int score2;

       int score3;

       do {

           System.out.println("Enter first Score Enter score between 1 -50");

           score1 = in.nextInt();

       } while(score1>50 || score1<0);

       do {

           System.out.println("Enter second Score.The second score must be between 1 -50");

           score2 = in.nextInt();

       } while(score2>50 || score2<0);

       do {

           System.out.println("Enter Third Score Third score must between 1 -50");

           score3 = in.nextInt();

       } while(score3>50 || score3<0);

       //Find the minimum of the three to drop

       int min, min2, max;

       if(score1<score2 && score1<score3){

           min = score1;

           min2 = score2;

           max = score3;

       }

       else if(score2 < score1 && score2<score3){

           min = score2;

           min2 = score1;

           max = score3;

       }

       else{

           min = score3;

           min2 = score1;

           max = score2;

       }

       System.out.println("your entered "+max+", "+min2+" and "+min+" the min is");

       int total = max+min2;

       System.out.println("Total of the two highest is "+total);

       //Finding the grade based on the cut-off points given

       if(total>=90){

           System.out.println("Grade is A");

       }

       else if(total>=80){

           System.out.println("Grade is B");

       }

       else if(total>=70){

           System.out.println("Grade is C");

       }

       else if(total>=60){

           System.out.println("Grade is D");

       }

       else{

           System.out.println("Grade is F");

       }

   }

}

Explanation:

  • Implemented with Java
  • Use the scanner class to receive user input
  • Use a do.....while loop to validate user input for each of the variables. A valid score must be between 0 and 50 while(score>50 || score<0);  
  • Use if and else to find the minimum of the three values and drop
  • Add the two highest numbers
  • use if/else if /else statements to print the corresponding grade
8 0
1 year ago
You are attempting to open a file containing a list of integer numbers, each on a separate line, and read them into Python as in
baherus [9]

Answer:

The answer to this question can be given as:

Statement:

number = int(line.strip())

Explanation:

In the above statement, we declare an integer variable number accept the integer value from the file that name is line. In this line, we use the strip() function. This function returns a duplicate string with both starting and tracking characters removed (based on the string parameter passed). The strip() function removes characters from both sides (left and right) based on the parameter(a string defining the collection of characters to be removed).

7 0
1 year ago
Information gathered from observing a plant grow 3 cm over a two-week period results in _______.a. inferences. b. variables. c.
Leya [2.2K]

Answer:

The answer is d. Data

Explanation:

information gathered from observing a plant grow 3 cm over a two-week period results in Data

data is facts and statistics collected together for reference or analysis.

Data is any information that has been collected, observed, generated or created to validate original research findings

6 0
2 years ago
If parties in a contract are not ____, the contract can be canceled.
Anastasy [175]
Agreed to all the terms mentioned in the contract
5 0
2 years ago
Other questions:
  • Ajay wants to read a brief overview about early settlers in the United States. Which type of online text source should he most l
    9·2 answers
  • Is used to process certificates and private/public key information?
    12·1 answer
  • When driving, your attention is __________.
    5·2 answers
  • Select the correct answer. Rachel needs to make a presentation on ethics and etiquettes in college. She has about 30 minutes to
    13·1 answer
  • 9.10: Reverse ArrayWrite a function that accepts an int array and the array ’s size as arguments . The function should create a
    9·1 answer
  • Software as a Service (SaaS) refers to the use of computing resources, including software and data storage, on the Internet rath
    13·1 answer
  • What output is produced by the following program segment? Why? (Recall that name.charAt(i) is the i-th character in the string,
    11·1 answer
  • A mobile device user has tried to install a new app numerous times without success. She has closed all unused apps, disabled liv
    7·1 answer
  • Which of the following could NOT be represented by a boolean variable?
    8·1 answer
  • What web 2.0 features allows users to subscribe to a data plan that charges for the amount of time spent on the internet?
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!