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
Vesnalui [34]
3 years ago
14

Write an if-else statement to describe an integer. Print "Positive even number" if isEven and is Positive are both true. Print "

Positive number" if isEven is false and is Positive is true. Print "Not a positive number" otherwise. End with newline.
Computers and Technology
1 answer:
Nina [5.8K]3 years ago
6 0

Answer:

C code explained below

Explanation:

#include <stdio.h>

#include <stdbool.h>

int main(void) {

int userNum;

bool isPositive;

bool isEven;

scanf("%d", &userNum);

isPositive = (userNum > 0);

isEven = ((userNum % 2) == 0);

if(isPositive && isEven){

  printf("Positive even number");

}

else if(isPositive && !isEven){

  printf("Positive number");

}

else{

  printf("Not a positive number");

}

printf("\n");

return 0;

}

You might be interested in
D. What is the work of the following features:<br>1. Foot note​
Bess [88]

Answer:

In footnotes, information is separated by commas, while in the bibliography, it is separated by periods.

In footnotes, the author's first name is listed first, while in the bibliography, the author's last name is listed first.

The titles of books and journals are put in italics.

The titles of articles are put in quotation marks.

All key words in titles are capitalized.

Explanation:

3 0
3 years ago
Write a Comparator that compares String objects by the number of words they contain. Consider any nonwhitespace string of charac
Readme [11.4K]

Answer:

import java.util.Scanner;

public class num12 {

   public static void main(String[] args) {

       Scanner in = new Scanner(System.in);

       System.out.println("Enter the first String");

       String word1 = in.nextLine();

       System.out.println("Enter the second String");

       String word2 = in.nextLine();

       System.out.println("Enter the third String");

       String word3 = in.nextLine();

       //Remove all white spaces

        String cword1 = word1.replace(" ","");

       String cword2 = word2.replace(" ","");

       String cword3 = word3.replace(" ","");

       //Comparing the string by their lengths

       if(cword1.length()>cword2.length()&&cword1.length()>cword3.length()){

           System.out.println(word1+" Is the longest");

       }

       else if(cword2.length()>cword1.length()&&cword2.length()>cword3.length()){

           System.out.println(word2+" Is the longest");

       }

       else{

           System.out.println(cword3+" Is the longest");

       }

   }

}

Explanation:

Using Java Programming Language

Use the Scanner Class to obtain the String values from the user

Save them in different variables

Use the replace() method in java to remove white space from any of the string entered

Using if and else statements compare the lengths of the strings (word.length()) returns the length of the word.

Print out the word that is longest

NOTE I have compared three Strings, comparing two would have been more straigth forward

8 0
4 years ago
True or false?
sashaice [31]
True cars are fast and go fast
6 0
3 years ago
Read 2 more answers
Which act passed by the US government in 1998 criminalizes the production and distribution of technology that intends to evade a
ruslelena [56]
The Computer Fraud and Abuse Act I believe. Sorry if I’m wrong and I hope that it helps :)
8 0
3 years ago
Read 2 more answers
Suppose that an instructor assigns different letter grades based on points earned on a 10-point quiz, and that all scores have b
xeze [42]

Answer:

three

Explanation:

Since there are four grades to be represented, any three letter grades can correspond, with a one-to-one mapping, to the elements in the numeric array. Any point that is not represented can be given to the fourth letter grade.

This is also possible because it has been verified that all scores are between 0 and 10. Not more.

Hope this helps!

6 0
4 years ago
Other questions:
  • What is the term for an e-mail server program that receives sent messages and delivers them to their proper destination?
    14·1 answer
  • What traits make an effective leaader
    9·2 answers
  • What is not a basic function of a computer?
    10·2 answers
  • 2. Driving above the posted speed limit is _
    13·2 answers
  • When performing actions between your computer and one that is infected with a virus, which of the following offers NO risk of yo
    11·2 answers
  • 97 points pleaseeee helpppp
    8·2 answers
  • . The NFiPA 704 system uses a numerical value between _____ and _____ to indicate the level of hazard for that particular chemic
    7·1 answer
  • Consider the following concurrent tasks, in which each assignment statement executes atomically. Within a task, the statements o
    9·1 answer
  • A major retailer wants to enhance their customer experience and reduce losses
    6·1 answer
  • What is the difference between functional and non-functional testing
    9·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!