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
SashulF [63]
3 years ago
5

You would like the user of a program to enter a customer’s last name. Write a statement thaUse the variables k, d, and s so that

they can read three different values from standard input--an integer, a float, and a string respectively. On one line, print these variables in reverse order with exactly one space in between each. On a second line, print them in the original order with one space in between them.t asks user "Last Name:" and assigns input to a string variable called last_name.

Computers and Technology
1 answer:
mojhsa [17]3 years ago
6 0

Answer:

1st question:

Use the variables k, d, and s so that they can read three different values from standard input an integer, a float, and a string respectively. On one line, print these variables in reverse order with exactly one space in between each. On a second line, print them in the original order with one space in between them.

Solution:

In Python:

k = input()  #prompts user to input value of k i.e. integer value

d = input()  #prompts user to input value of d i.e. float value

s = input()  #prompts user to input value of s i.e. a string

print (s, d, k)  #displays these variable values in reverse order

print (k, d, s)#displays these variable values in original order

In C++:

#include <iostream>    // to use input output functions

using namespace std;   //to identify objects like cin cout

int main() {    //start of main function

  int k;   //declare int type variable to store an integer value

  float d; //  declare float type variable to store a float value

  string s;   //  declare string type variable to store an integer value

  cin >> k >> d >> s;    //reads the value of k, d and s

  cout << s << " " << d << " " << k << endl;     //displays these variables values in reverse order

  cout << k << " " << d << " " << s << endl;   } // displays these variable values in original order

Explanation:

2nd question:

You would like the user of a program to enter a customer’s last name. Write a statement that asks user "Last Name:" and assigns input to a string variable called last_name.

Solution:

In Python:

last_name = input("Last Name:")

# input function is used to accept input from user and assign the input value to last_name variable

In C++:

string last_name;  //declares a string type variable named last_name

cout<<"Last Name: ";  // prompts user to enter last name by displaying this message Last Name:

cin>>last_name; // reads and assigns the input value to string variable last_name

The programs alongwith their outputs are attached.

You might be interested in
When listing columns in the select list, what should you use to separate the columns?
Gala2k [10]
The answer is commas.  <span>When listing columns in the select list, commas should be used to separate the columns.</span>
6 0
3 years ago
In which case will the linear search return the lowest value faster than the<br> binary search?
Sveta_85 [38]

Answer:

A linear search is one that scans every record/file until it discovers the value being searched for.

Binary search, on the other hand, is also known as <em>Logarithmic search</em>. It is used to locate the position of a value inside an array that has already been sorted.  

The linear search will return the lowest value faster than the binary search when small arrays are involved.

This will only be feasible when the array is sorted prior.

Cheers!

5 0
3 years ago
Adding _____ will allow the user to create text as it will often appear in publications with multiple articles, such as a newspa
mart [117]
Does applications make sense <span />
5 0
3 years ago
Read 2 more answers
Put your snap in the comments below if you want to be friends
jok3333 [9.3K]

Answer:

I don't have S nap, but my ensta is  brandnewmillennium

Explanation:

4 0
3 years ago
Read 2 more answers
You have been hired by an educational software company to create a program that automatically calculates the sum of each place-v
Vinvika [58]

Hi, you haven't provided the programing language, therefore, we will use python but you can extend it to any programing language by reading the code and the explanation.

Answer:

n1 = int(input("First numeber: "))

n2 = int(input("Second numeber: "))

for i in range(5):

   r1 = n1%10

   r2 = n2%10

   print(r1+r2)

   n1 = n1//10

   n2 = n2//10

 

Explanation:

  1. First, we ask for the user input n1 and n2
  2. We create a for-loop to calculate the sum of each place-value of two numbers
  3. We obtain the last number in n1 by using the mod operator (%) an the number ten this way we can always take the last value, we make the same for n2
  4. Then we print the result of adding the last two numbers (place value)
  5. Finally, we get rid of the last value and overwrite n1 and n2 to continue with the process

4 0
3 years ago
Other questions:
  • you install teamviewer on your workstation at home so that you can ac ess it when on the road. how can you be assured that unkno
    9·1 answer
  • Which group on the sparkline tools design tab would you choose if you wanted to change the data source of the sparkline? (1 poin
    10·1 answer
  • Advancement in technology is making peripherals...
    5·2 answers
  • Can anybody come up with a catchy title for this?
    11·1 answer
  • Match the terms with their definitions.
    5·2 answers
  • What’s some WiFi passwords for some big brands that I can connect to while traveling?
    7·1 answer
  • NEED HELP NOW 25 POINTS WILL MARK BRAINLIEST!!!!!!!
    8·1 answer
  • Suppose a host has a 1-MB file that is to be sent to another host. The file takes 1 second of CPU time to compress 50%, or 2 sec
    12·1 answer
  • ____________ are the in – built functions that perform a particular pre – defined task when used in a computer program.
    13·1 answer
  • Anyone know why my desktop won’t turn on, I upgraded my ram and my monitor won’t turn on
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!