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
A.<br> Post-It note<br> b.<br> notebook<br> c.<br> tutor<br> d.<br> spell check
Ostrovityanka [42]
What is this for? like what is the question?


4 0
3 years ago
use c , c, java or python (any one) programming language for the following programming exercises. do not call built-in library f
Karo-lina-s [1.5K]

A function that receives a string containing a 32-bit hexadecimal integer. the function must return the decimal integer value of the hexadecimal integer.

<h3>The C++ Program</h3>

#include<iostream>

#include <cstring>

#include <string>

using namespace std;

int getDecimalForm(string);

int main() {

 // string binary;

 // Reads both 0 and B as int 48 while B should be

 string hexadecimal = "01F12EBA";

 int decimalForm;

 int re = hexadecimal[0], te = hexadecimal[1];

 /*cout << "Input an eight digit binary string of 1s and 0s to find the integer

 value in decimal form:\n"; cin >> binary;

 // Input validation

 while (binary.size() != 8 || ((binary[0] != '0' && binary[0] != '1')

 || (binary[1] != '0' && binary[1] != '1') || (binary[2] != '0' && binary[2] !=

 '1')

 || (binary[3] != '0' && binary[3] != '1') || (binary[4] != '0' && binary[4] !=

 '1')

 || (binary[5] != '0' && binary[5] != '1') || (binary[6] != '0' && binary[6] !=

 '1')

 || (binary[7] != '0' && binary[7] != '1')))

 {

 cout << "Input a valid eight digit binary string of only ones and zeros\n";

 cin >> binary;

 }*/

 cout << "The 32-bit binary integer value is " << hexadecimal << endl;

 cout << re << " " << te << " " << hexadecimal[0] - 55 << endl;

 decimalForm = getDecimalForm(hexadecimal);

 cout << endl

      << decimalForm << " is the same integer value expressed in decimal form";

}

// a function in C++ that receives a string containing a 16 - bit binary integer

int getDecimalForm(string hStr) {

 int value, num = 1, total = 0, exponent = 0;

 // Made adding happen starting from the right side

 for (int i = (hStr.size() - 1); i >= 0; i--) {

   if ('0' <= hStr[i] <= '9') {

     cout << hStr[i] << " cat\n";

    if (exponent != 0) {

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

         num *= 16;

       }

     }

     value = num * (hStr[i] - 48);

   }

   if ('A' <= hStr[i] <= 'F') {

     cout << hStr[i] << " dog\n";

     if (exponent != 0) {

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

         num *= 16;

       }

     }

     value = num * (hStr[i] - 55);

   }

   // Keep adding the value of the binary integer

   total += value;

   num = 1;

   exponent++;

 }

 return total;

}


Read more about C++ program here:

brainly.com/question/20339175

#SPJ1

3 0
1 year ago
What is the term for a server at the highest level of the Domain Name System (DNS)?
Igoryamba

Answer:

Root name server, root level server, or root server.

Explanation:

Root level server, root name server or simply root server is the server responsible for basic functions in translating domain names into IP addresses.  It is situated in the root zone of the domain name system (DNS) which is the largest layer in the DNS' name space.  

<em>Hope this helps!</em>

5 0
4 years ago
How does 5G technology enhance the Internet of Things (IoT)?
SashulF [63]

Answer:

<em><u>5G Will Quickly Become The New Standard For Cellular Networks. The Internet of Things (IoT) is rapidly developing and expanding. ... 5G will increase cellular bandwidth by huge amounts, making it much easier for the Internet of Things to network large numbers of devices together.</u></em>

Explanation:

Hope its help

5 0
3 years ago
Sort short_names in reverse alphabetic order.
tangare [24]

lst = short_names.split()

print(sorted(lst,reverse = True))

6 0
3 years ago
Other questions:
  • How many bits are in 1 tb? [hint: depending on the tool used to calculate this, you may need to use a trick to get the exact res
    6·1 answer
  • Jason is computer professional who has access to sensitive information. He shares this information with another organization in
    7·2 answers
  • How do Hlookup and Vlookup differ?
    5·2 answers
  • Minerals can form deep inside Earth’s crust by
    13·1 answer
  • What are some effective methods for scrolling? Check all that apply.
    6·1 answer
  • List three types of Software:
    15·1 answer
  • Which formatting options can be changed by selecting the Design tab? Check all that apply.
    7·2 answers
  • What is a benefit of an account with interest?
    5·1 answer
  • Differentiate between soft copy output and hard copy output?​
    12·2 answers
  • The specialized programs used by the operating systems to help ensure that memory is used properly and there are no memory confl
    15·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!