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
brilliants [131]
3 years ago
12

Give your own example of a nested conditional that can be modified to become a single conditional, and show the equivalent singl

e conditional.
Computers and Technology
1 answer:
victus00 [196]3 years ago
3 0

Answer:

following are the program to the given question:

Program:

x = 0#defining an integer variable that holds a value

if x < 0:#defining if that checks x less than 0

   print("This number ",  x, " is negative.")#print value with the message

else:#defining else block

   if x > 0:#defining if that checks x value greater than 0

       print(x, " is positive")#print value with message

   else:#defining else block

       print(x, " is 0")#print value with message

if x < 0:#defining another if that checks x less than 0

   print("This number ",  x, " is negative.")

elif (x > 0):#defining elif block that check x value greater than 0

   print(x, " is positive")#print value with message

else:#defining else block

   print(x, " is 0")#print value with message

Output:

Please find the attachment file.

Explanation:

In this code, an x variable is defined which holds a value that is "0", in the next step nested conditional statement has used that checks the x variable value and uses the print method that compares the value and prints its value with the message.

In another conditional statement, it uses if that checks x value less than 0 and print value with the negative message.

In the elif block, it checks x value that is greater than 0 and prints the value with the positive message, and in the else block it will print the message that is 0.

You might be interested in
Reed Hastings created Netflix. His inspiration came from the fact that he had to pay a sizeable late fee for returning a DVD bey
noname [10]

Answer:

Which statement accurately describes his key to success?

Explanation:

The success in Netflix lies in offering:

1. Entertainment;

2. fun;

3. originality;

4. innovation and

5. happiness.

Netflix learning is:

1. Bet on your content.

2. Brand Personality.

3. Visual universe.

4. Customization

5. Big Data helps Netflix continue to grow and improve customer service.

3 0
3 years ago
Who wrote the book of luke​
netineya [11]
Luke himself wrote t the book
5 0
2 years ago
You can send emails to individuals from your address book.<br><br> True<br> False
MAXImum [283]
I believe the answer is False or I may be wrong
5 0
3 years ago
Write a program (using functions) starting from directives to compute and display the transpose of a matrix of dimension m x n.
pentagon [3]

Answer:

#include <iostream>

#include <cstdlib>

using namespace std;

int m, n;

void transpose(int matrix[]){

  int transp[m][n];

  for (int i = 0; i < n; i++){

     for (int j = 0; j < m; j++){

        transp[j][i] = matrix[i][j];

        cout<< transp[j][i]<< " ";

     }

     cout<< "\n";

  }

}

int main(){

  cout<< "Enter the value for n: ";

  cin>> n;

  cout>> "Enter the value for m: ";

  cin>> m;

  int mymatrix[n][m];

  for (int i = 0; i < n; i++){

     for (int j = 0; j < m; j++){

        mymatrix[i][j] = (rand() % 50);

     }

  }

  transpose(mymatrix);

}

Explanation:

The C source code defined a void transpose function that accepts a matrix or a two-dimensional array and prints the transpose on the screen. The program gets user input for the row (n) and column (m) length of the arrays. The C standard library function rand() is used to assign random numbers to the array items.

3 0
3 years ago
There are five identical closed boxes. one box contains $10,000, two boxes contain $1000 each, one box contains $1, and the last
sp2606 [1]
Mean means most and the most he can get is the 10000 and the 2 1000s and the 1 dollar so the mean is 12001.
6 0
3 years ago
Other questions:
  • Which of the following statements is true?
    6·1 answer
  • Which of the following tasks would a database administrator perform ? A identify computer security photos, B. Make sure protocol
    15·1 answer
  • On Brainly, how can I change my username? from halfsidepancake​
    6·2 answers
  • Two samples of dirt are collected from a suspect's tread in his shoe and a crime scene. The forensic investigator does a gross e
    6·2 answers
  • Visual Basics: 1 ) Write an if/else statement that compares the double variable pH with 7.0 and makes the following assignments
    9·1 answer
  • Theodor is researching computer programming. He thinks that this career has a great employment outlook, so he'd like to learn if
    9·2 answers
  • Adam has designed and tested an Android app for a startup. The client expects to get quick responses to the app. After consultin
    7·1 answer
  • )
    11·1 answer
  • When analyzing data sets, such as data for human heights or for human weights, a common step is to adjust the data. This adjustm
    13·1 answer
  • Answer the questions given below, share your ideas.Use the space for your answer.
    14·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!