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
Nataliya [291]
3 years ago
15

How should I do it Please code for Java

Computers and Technology
1 answer:
andrew-mc [135]3 years ago
3 0

Answer:

class Main {  

 public static void printPattern( int count, int... arr) {

     for (int i : arr) {

       for(int j=0; j<count; j++)

           System.out.printf("%d ", i);

       System.out.println();

     }

     System.out.println("------------------");

 }

 public static void main(String args[]) {

   printPattern(4, 1,2,4);

   printPattern(4, 2,3,4);

   printPattern(5, 5,4,3);

 }

}

Explanation:

Above is a compact implementation.

You might be interested in
You can pin applications to which two areas?
mrs_skeptik [129]

Answer:

A and C.

Explanation:

The taskbar and the Start are both shortcuts to use when opening applications. The taskbar is at the bottom of your computer or pc. And the start can be opened by pressing the windows key or clicking on windows at the bottom right (Windows only.)

Hope that helps!

5 0
3 years ago
Take the average of some numbers. Show all the numbers that are below average. You can assume that there will not be more than 2
olchik [2.2K]

Here is code in java.

import java.util.*; // import package

class Main //  creating class

{

public static void main (String[] args) // main method

{

Scanner br=new Scanner(System.in); // scanner class for input

       int []a=new int[20]; // declaring array

       int count=0,x,j; // creating variable

       int sum =0;

       System.out.println("Enter a weight (0 to stop):");

       x=br.nextInt(); // taking input

while(x!=0) // iterating over the loop

       {

           a[count] = x;

           count++;

           System.out.println("Enter a weight (0 to stop):");

           x=br.nextInt();

}

       for( j=0;j<count;j++) // iterating over the loop

       {

       sum+=a[j];

       }

       double avg = sum/(double)count;

       System.out.println("The total is: "+sum);

       System.out.println("The average is: "+avg);

       System.out.println("Here are all the numbers less than the average: ");

     for( j=0;j<count;j++) //  // iterating over the loop

       {

           if(a[j]<avg)

           System.out.print(a[j]+" ");

       }

}

}

Explanation:

First create an object of "Scanner" class to read input from the user.

Create an array of size 20, which store the number given by user.Ask user

to give input and keep the count of number in the variable "count". If user

give input 0 then it will stop taking input.And then calculate sum of all the

input.It will calculate average by dividing the sum with count and print it.

It will compare the all elements of array with average value, if the element

is less than average, it will print that element.

Output:

Enter a weight (0 to stop):

1

Enter a weight (0 to stop):

2

Enter a weight (0 to stop):

3

Enter a weight (0 to stop):

4

Enter a weight (0 to stop):

5

Enter a weight (0 to stop):

6

Enter a weight (0 to stop):

7

Enter a weight (0 to stop):

8

Enter a weight (0 to stop):

9

Enter a weight (0 to stop):

10

Enter a weight (0 to stop):

0

The total is: 55

The average is: 5.5

Here are all the numbers less than the average:

1 2 3 4 5

6 0
3 years ago
Analyze the error in the html code :<br><br> HTML
Andrei [34K]

Answer:

The World Wide Web Consortium provide a simple online tool (https://validator.w3.org/) that automatically check your HTML code and point out any problems/errors your code might have, such as missing closing tags or missing quotes around attributes.

Explanation:

your question is not clear

hope it helps

6 0
3 years ago
What is the different between information and data
Scorpion4ik [409]

Answer:

Information is the act of imparting knowledge and data is the recorded observation that are usually presented in a structured format

6 0
3 years ago
What is BINARY it is making get confused
enot [183]
It is a number that is expressed in the binary numerical system
6 0
3 years ago
Other questions:
  • The four functions of a computer are
    5·1 answer
  • Which service is enabled on a cisco router by default that can reveal significant information about the router and potentially m
    10·1 answer
  • Using numerous computers to inundate and overwhelm the network from numerous launch points is called a(n) ________ attack.
    9·1 answer
  • When you identify the data elements in a new database, you typically subdivide data elements into?
    14·1 answer
  • Terminal resource security is a software feature that erases the screen and signs a user off automatically after a specified len
    14·1 answer
  • T FROW PYCW GCYN TA T ODYHP WQROW TW<br><br> Someone decode pls
    14·1 answer
  • This program will output a right triangle based on user specified height triangleHeight and symbol triangleChar. (1) The given p
    14·1 answer
  • What is income?
    10·2 answers
  • The purpose of​ a/an _________ system is to capture best practice solutions and program them into a set of rules in a software p
    13·1 answer
  • What are the main security weaknesses of coaxial cable, twisted pair cable, and fiber optic cable? How might the router itself b
    8·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!