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
SOVA2 [1]
3 years ago
8

Write code which prints every number from 1 to 20 a number of times equal to the number itself (e.g. one 1, two 2's...). Every i

ndividual number printed should be separated by a space, and there should be a new line each time the number changes. You should use nested loops to produce your output (it will result in far less code).
Partial sample run:

1
2 2
3 3 3
........

Note: Java
Computers and Technology
1 answer:
Oksi-84 [34.3K]3 years ago
6 0

public class JavaApplication71 {

   

   public static void main(String[] args) {

       for (int i = 1; i <= 20; i++){

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

               System.out.print(i+" ");

           }

           System.out.println("");

       }

   }

   

}

I hope this helps!

You might be interested in
Kelly is evaluating the following image. Which of the statements that she makes about the photograph is true?
Stells [14]

Photo not included

Plz add photo

7 0
3 years ago
Lập trình web truy vấn csdl và hienr thị ra màn hình danh sách các bản ghi
almond37 [142]

Answer:

ExplanatOverfishing occurs "when more fish are caught than the population can replace through natural reproduction," according to the World Wildlife . Once this occurs, the species is no longer "sustainable." Eighty-seven percent of all the world's fish stocks that we know about are at the "breaking point," according to the Environmental Defense Fund (EDF).

ion:

3 0
3 years ago
Indonesia is planning to move its capital from Jakarta to the island of Borneo in the hope that the burden of congestion, regula
JulijaS [17]

Answer:

Indonesia's capital has just been relocated from Jakarta to a site within the jungle of Kalimantan on Borneo island after parliament approved the bill. It will strengthen supply chains and place Indonesia "in a more strategic position in world trade routes, investment flows, and technological innovation."

Explanation:

mark as brainiest

6 0
2 years ago
Read 2 more answers
C++ coding, help
Zanzabum

Answer:

The program in C++ is as follows:

#include <fstream>

#include <iostream>

#include <iomanip>

using namespace std;

int main() {

 string filename;

 cout<<"Filename: ";

 cin>>filename;

 ifstream inFile(filename);

 if(!inFile) {

   cout << endl << "Cannot open file " << filename;

   return 1;  }  

 ofstream fout;

 ifstream fin;

 fin.open("invalid-numbers.txt");  

 fout.open ("invalid-numbers.txt",ios::app);  

 double sum = 0; int valid = 0; int invalid = 0;

 double num = 0;

 while(!inFile.eof()) {

   inFile >> num;

   if(num >= 0 && num<=110){   sum+=num; valid++; }

else{ invalid++;

if(fin.is_open()){

   fout<<fixed<<setprecision(2)<<num<<"\n";    }  }  }

 fin.close();

 fout.close();

 inFile.close();

 cout<<"Total values: "<<valid+invalid<<endl;

 cout<<"Invalid values: "<<invalid<<endl;

 cout<<"Valid values: "<<valid<<endl;

 cout<<"Average of valid values: "<<fixed<<setprecision(2)<<sum/valid<<endl;    

 double inv;

 ifstream inFiles("invalid-numbers.txt");

 while(!inFiles.eof()) {

   inFiles >> inv;

   cout<<inv<<"\n";

}

inFiles.close();

 return 0;

}

Explanation:

See attachment for source file where comments are used to explain each line

Download cpp
4 0
3 years ago
Which statement about sample size is true?
natima [27]
I’d say b I’m not sure tho
6 0
3 years ago
Other questions:
  • Consider the following page reference string:
    12·1 answer
  • Why is it important to evaluate the website on which you plan to shop?
    11·2 answers
  • A web page that allows interaction from the user​
    12·1 answer
  • Is there anything I can do to fix my laptop? It is a chrome book and my school provided it. Everything is still working.If anyon
    14·2 answers
  • La tensión en Newtons necesaria para que una onda transversal cuya longitud de onda es​
    10·1 answer
  • Where do the projection lines converge in a perspective sketch?
    13·1 answer
  • Make a list of any four computer that were used in the history of computer.​
    6·1 answer
  • How is blockchain different from traditional database models?
    12·1 answer
  • Which option in PowerPoint allows users to configure the number of columns and rows manually, using numerical values?
    6·1 answer
  • In the classic experimental design, there are two groups: the _____ group and the _____ group.
    12·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!