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
Llana [10]
3 years ago
12

Write code which takes a user input of a String and an integer. The code should print each letter of the String the number of ti

mes the user inputted in reverse order. I believe it's supposed to use nested loops, but I can only get it to repeat the whole word backwards x times.
ex.
Input a String:
code
Input an integer:
3
eeedddoooccc
Computers and Technology
1 answer:
il63 [147K]3 years ago
8 0

import java.util.*;

public class myClass {

public static void main(String args[]) {

Scanner scan = new Scanner(System.in);

System.out.print("Input a String: ");

String str = scan.nextLine();

System.out.print("Input an integer: ");

int num = scan.nextInt();

for(int i=str.length()-1; i>=0; i--) {

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

System.out.print(str.charAt(i));

}

}

}

}

You might be interested in
Which feature of a typical professional networking site helps users add professional details to their profile ?
ludmilkaskok [199]
All I  could find are networking cites allow people to take pics of themselves for a personal effect! hope this is what your looking for.
7 0
3 years ago
Read 2 more answers
p3_unzip :: [(a,b)] -&gt; ([a], [b]) Write a function that takes a list of two-tuples and returns a tuple of two lists -- the fi
klio [65]

Answer:

<em>C++.</em>

Explanation:

#include <iostream>

#include<tuple>

using namespace std;

////////////////////////////////////////////////////////////

tuple<char*, int*> p3_unzip(tuple<char, int>* list, int count) {

   char* list1 = new char[count];

   int* list2 = new int[count];

   

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

       tuple<char, int> temp = list[i];

       list1[i] = get<0>(temp);

       list2[i] = get<1>(temp);

   }

   

   tuple<char*, int*> new_tuple;

   get<0>(new_tuple) = list1;

   get<1>(new_tuple) = list2;

   

   return new_tuple;

}

int main() {

   tuple<char, int>* list;

   int count = 0;

   ////////////////////////////////////////

   cout<<"How many tuples? ";

   cin>>count;

   list = new tuple<char, int>[count];

   cout<<endl;

   

   char a;

   int b;

   tuple<char, int> temp;

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

       cout<<"tuple "<<i+1<<" char: ";

       cin>>a;

       get<0>(temp) = a;

       

       cout<<"tuple "<<i+1<<" int: ";

       cin>>b;

       get<1>(temp) = b;

       

       list[i] = temp;

       cout<<endl;

   }

   ////////////////////////////////////////

   tuple<char*, int*> new_tuple = p3_unzip(list, count);

   char* list1 =  get<0>(new_tuple);

   int* list2 = get<1>(new_tuple);

   

   cout<<"Returned tuple:([";

   for (int i=0; i<count-1; i++) {

       cout<<list1[i]<<", ";

   }

   

   cout<<list1[count-1]<<"],[";

   

   for (int i=0; i<count-1; i++) {

       cout<<list2[i]<<", ";

   }

   

   cout<<list2[count-1]<<"])";

   ////////////////////////////////////////

   delete[] list, list1, list2;

   return 0;

}

4 0
4 years ago
Which options can be adjusted in the Print settings?
Ilya [14]
Adjust the number of copies you want, print range
5 0
3 years ago
Internal hard disks are an example of ____ storage devices.
MA_775_DIABLO [31]
The answer is <span>magnetic. </span>
5 0
3 years ago
I have some true or false questions I need help with. 9th grade.**
alisha [4.7K]

Answer:

Hardware can be traced back to ancient times. False

Hardware is only found in computers. False

Instruments and weaving looms were some of the first pieces of hardware. False

Computers and hardware is the same thing. This question is a bit broad but there's many different types of hardware. From keyboards to printers to speakers.

I tried my best not exactly sure though.

4 0
3 years ago
Other questions:
  • Given the Query Data Type, which of the following is incorrectly matched with the corresponding Storage Data Type?
    15·1 answer
  • 1. What conversion factor should be used to convert from Gigaliters to liters?
    14·1 answer
  • Which of the following is not a metamorphic agent?
    8·2 answers
  • Janice usually works on a particular workbook. She decides to keep a backup of all the data in a separate workbook. She opens a
    6·2 answers
  • The primary purpose of an ids is to detect intrusions, log suspicious events, and send alerts.
    7·1 answer
  • What is a resume?A collection of all your professional and artistic works.A letter which explains why you want a particular job.
    6·1 answer
  • What are the "..........." called leading up to a page number?
    14·1 answer
  • The student cd contains a file named random.txt. This file contains a long list of random numbers. copy the file to your hard dr
    6·1 answer
  • A/an _____________ is a stored program that executes at a specified time. Group of answer choices stored procedure view trigger
    6·1 answer
  • Declaring a member as ____ in the base class provides access to that member in the derived classes but not to anyone else. a. pu
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!