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
Ainat [17]
3 years ago
8

Ask the user to enter a number for red, green, and blue components of an RGB value. Test to make sure each value is between 0 an

d 255 inclusive. If a color's value is out of range, print which component is not correct (e.g., "Red number is not correct" if the red value is 300). Multiple colors may be out of range.
Computers and Technology
1 answer:
olganol [36]3 years ago
3 0

Answer:

  1. r = int(input("Enter a number for red channel: "))
  2. g = int(input("Enter a number for green channel: "))
  3. b = int(input("Enter a number for blue channel: "))  
  4. if(r < 0 or r >255):
  5.    print("Red number is not correct.")
  6. if(g < 0 or g >255):
  7.    print("Green number is not correct.")
  8. if(b < 0 or b >255):
  9.    print("Blue number is not correct.")

Explanation:

The solution code is written in Python.

Firstly, prompt user to input three numbers for red, green and blue (Line 1-3).

Next, create three similar if statements to check if the red, green and blue are within the range 0-255 by using logical operator "or" to check if the number is smaller than 0 or bigger than 255. If either one condition is met, display a message to indicate a particular color number is not correct (Line 5-12).

You might be interested in
What are the steps for adding an action button to a slide? Choose the correct answers from the drop-down menus. 1. First, go to
Marysya12 [62]

Answer:

insert, illustrations, click and drag, slide show

Explanation:

i got it right

7 0
2 years ago
Read 2 more answers
Do the following SQL questions. The resulting columns must all have descriptive names. You must show the result of the query. Fo
Maslowich

Answer:

We can use CREATE command to create tables with columns having descriptive names

Explanation:

Firstly, create a table using CREATE  command in SQL. The syntax is as follows:

CREATE TABLE [table_name]

(

 [col_name] [datatype]),

[col_name] [datatype]),

[col_name] [datatype]),

[col_name] [datatype])

)

Once the table is created, we can insert the data into table using INSERT command. It's syntax is as follows:

INSERT INTO table_name VALUES('', '', '')

if datatype is string, values must be entered within single quotes. If datatype is int, values are entered directly without using  quotes.

Now, you can select the data from  the table using SELECT command. It's syntax is as follows:

SELECT column-list FROM table_name

If you want to filter rows according to conditions, you can use WHERE command.

I have created  sample table and inserted some data into it. Now, I applied some queries on it to select data from the table.

I have written in a text file and attached the same. Please find. Thank you!

Download txt
3 0
3 years ago
In 1-2 sentences, describe how you would open a new word processing document.
Gennadij [26K]
This depends on what computer and
System it's running on
4 0
3 years ago
Complete this truth Table. Write a program that you can enter from the keyboard, a 1 or 0 into three Boolean variables, A,B,C. W
SSSSS [86.1K]

Answer:

Following are the code to this question:

#include<stdio.h>//defining header file

int AND(int x,int y) //defining a method AND that hold two variable in its parameter

{

if(x==1 && y==1)//defining if block to check x and y value is equal to 1

{

return 1;//return value 1

}

else //defining else block

{

   return 0;//return value 0

}

}

int OR(int x,int y)//defining method OR that hold two variable in its parameter

{

if(x==0&&y==0)//defining if block to check x and y value is equal to 1

{

return 0;//return value 0

}

else //defining else block

{

   return 1;//return value 1

}

}

int main()//defining main method

{

int a,b,c;//defining integer variable  

int k=1;//defining integer variable k that holds a value 1

while(k<=8)//defining while loop for 8 time input

{

printf("Please insert 3 numbers in (0 0r 1):\n ");//print message

scanf("%d%d%d", &a, &b, &c);//input value

k++;//increment the value of k by 1

printf("value: %d\n",AND(OR(a,b),c));

}

return 0;

}

Output:

please find the attachment.

Explanation:

In the above-given C language code two methods "AND and OR" is declared, holds two integer variable "x and y" in its parameters, inside the method a conditional it used that can be defined as follows:

  • In the AND method, inside a conditional statement, if block check x and y both value is same that is 1 it will return 1 or it will goto else block in this it will return value 0.      
  • In the OR method, inside a conditional statement, if block check x and y both value is the same, that is 0 it will return 0 or it will goto else block in this it will return value 1.
  • In the main method, four integers "a,b,c, and k" is declared in which variable "a, b, c" is used in the loop for 8 times input values from the user and print method is used to call the method and prints its return values.

8 0
3 years ago
The length, height, and width of a cube are 10, 7, and 5 cm respectively. Write a program that calculates the volume, perimeter,
RideAnS [48]

Answer:

// code in C++.

#include <bits/stdc++.h>

using namespace std;

// main function

int main()

{

   // variables

   int length=10,height=7,width=5;

   // find the volume of

   int vol=length*height*width;

   // find the surface area

   int sa=2*(length*width+length*height+height*width);

   // find the perimeter

   int peri=4*(length+width+height);

   // print the volume

   cout<<"Volume is: "<<vol<<" cm^3."<<endl;

   // print the surface area

   cout<<"Surface area is: "<<sa<<" cm^2."<<endl;

   // print the perimeter

   cout<<"Perimeter is: "<<peri<<" cm."<<endl;

return 0;

}

Explanation:

Declare and initialize length=10, width=5 and height=7.calculate volume by multiply length, width and height and assign to variable "vol".Then find the surface area as 2*(length*width+length*height+height*width) and assign it to variable "sa".Then find the perimeter as 4*(length+width+height) and assign to variable "peri". Print the volume, perimeter and surface area.

Output:

Volume is: 350 cm^3.

Surface area is: 310 cm^2.

Perimeter is: 88 cm.

8 0
3 years ago
Other questions:
  • To gain one pound of fat, how many extra calories would you need to consume?
    12·1 answer
  • The "fathers of the Internet" are Vinton Cerf and ________. Select one: A. Robert Kahn B. Robert Cailliau C. Tim Berners-Lee D.
    11·1 answer
  • The part of the computer that provides access to the internet is the-?
    15·2 answers
  • Jenny is working on a laptop computer and has notices that the computer is not running very fast. She looks and realizes that th
    6·2 answers
  • A pair of single quotes ' will prevent the shell from interpreting any special character. True or False
    15·1 answer
  • Which best describes the differences between a resume and a CV?
    13·2 answers
  • What can you find the under the privacy policy section of a shopping website?
    12·1 answer
  • Which of the following is not a command for determining if MySQL is running on Linux (Ubuntu)?
    7·1 answer
  • Haley is responsible for checking the web server utilization. Which things should she review while checking the server utilizati
    8·2 answers
  • Which of the following is NOT a possible combination of values of the variables in this program when it finishes running?
    6·2 answers
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!