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
ira [324]
3 years ago
13

Java

Computers and Technology
1 answer:
Valentin [98]3 years ago
3 0

Answer:

import java.util.Scanner;

public class LabProgram{

    public static void main(String []args){

       Scanner input = new Scanner(System.in);

       int red,blue,green,smallest;

       System.out.print("Enter three numbers between 0 and 255 (inclusive): ");

       red =input.nextInt();

       green =input.nextInt();

       blue =input.nextInt();

       

       if(red <= blue && red <= green){

       smallest = red;

       }

       else if(green <= red && green <= blue){

           smallest = green;

       }

       else{

            smallest = blue;

       }

       System.out.print((red - smallest)+" "+(green - smallest)+" "+(blue - smallest));

}

}

Explanation:

This line declares necessary variables

int red,blue,green,smallest;

This line prompts user for input of 3 numbers

System.out.print("Enter three numbers between 0 and 255 (inclusive): ");

The next three lines gets user inputs

       red =input.nextInt();

       green =input.nextInt();

       blue =input.nextInt();

The following iteration checks for the smallest for red, green, blue

       if(red <= blue && red <= green){

       smallest = red;

       }

       else if(green <= red && green <= blue){

           smallest = green;

       }

       else{

            smallest = blue;

       }

This line prints the required output

       System.out.print((red - smallest)+" "+(green - smallest)+" "+(blue - smallest));

You might be interested in
Assume that the variables gpa, deansList and studentName, have been declared and initialized . Write a statement that both adds
Alborosie

Answer:

Following are the statement which is given below:

if (gpa > 3.5)  // check the condition if gpa exceeds 3.5.

{

deansList++;  // increment of 1 in the deansList variable

cout << studentName;  // display the studentName,  

}

Explanation:

The description of the statement

  • In the if statement we check the condition of "gpa" .if  "gpa"  is greater then 3.5 then it executed the statement inside the if block otherwise nothing will be executed.
  • if control moves to the if part it adds to 1 to the deansList.
  • Finally, display the value of studentName.
3 0
3 years ago
Please help <br>if I clear data on play services framework, will it delete all files on phone​
asambeis [7]

Answer:

Hey there!

Explanation:

Hope this helps :)

5 0
3 years ago
George wants to edit the font of the title in his presentation. Where can he find the option to edit it?
Bad White [126]

The answer could be B. Tool Bar

6 0
3 years ago
Read 2 more answers
The details of _____ vary from state to state, but generally create personal jurisdiction over nonresidents who transact busines
irinina [24]

Answer: B. LONG-ARM STATUTES

Explanation: long-arm statute is the jurisdiction that gives a court the authority to prosecute a case involving an out of state defendant or resident based on certain acts committed by the out of state defendant or resident with the premise that the out of state defendant or resident has a minimum connection with the state.

Which means the out of state defendant or resident must have a systematic and constant activity within the Jurisdiction of the Court and a cause of action that came up from that activity.

6 0
3 years ago
Read 2 more answers
. Describe the types of colleges and choose one that you think you will apply to and why.
tatiyna

Well their is all boy colleges and all girl colleges, i will apply for an all boy college because i am male

4 0
4 years ago
Read 2 more answers
Other questions:
  • Can someone can help me am dont know how much RAM do i need. I use my pc for work and to watch yt vid. Thanks​
    10·1 answer
  • Which is the correct description of the first act in a classical game story structure?
    14·1 answer
  • Develop a CPP program to test is an array conforms heap ordered binary tree. This program read data from cin (console) and gives
    9·1 answer
  • Should a social network own our social data? Is it an invasion of privacy for social networks to collect and use the information
    6·1 answer
  • The internet is best described as a vast
    7·2 answers
  • Ive tried everything how can i get my images back ?
    13·2 answers
  • When adding shapes to a presentation, the outline can be one color, and the fill must be the exact same color.
    12·2 answers
  • Write a test program that prompts the user to enter three sides of the triangle (make sure they define an actual triangle), a co
    5·1 answer
  • A collection of code makes up which of the following?
    14·2 answers
  • 22. (a) List two arithmetic
    7·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!