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]
4 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]4 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
Whats the highest rank in brainly
vampirchik [111]

1. Beginner

2. Apprentice

3. Rising star

4. Helping Hand

5. Ambitious

6. Virtuoso

7. Expert

8. Ace

9. Genius

8 0
3 years ago
Read 2 more answers
Which of the following is considered both an input and output peripheral?
larisa [96]
Keyboard
Explaination: it is period
8 0
3 years ago
What is communication ​
Aneli [31]
What we are doing right now. It’s interactions with one another person or persons
3 0
3 years ago
Read 2 more answers
When changing lanes on an expressway signal your intentions and?
valkas [14]
Check your mirrors and blind spots
4 0
4 years ago
William wants to create a document using a DTP. What time-saving techniques can he use?
Verdich [7]
Projective ecodynamic blueglocose
6 0
4 years ago
Other questions:
  • Information Can Be Gathered Regarding The Temperature Of A Substance And Uploaded To A Computer Using A ___________ As A Data Co
    6·1 answer
  • All of these are required categories on a safety data sheet except
    14·2 answers
  • Which of the following typically have the highest auto insurance premiums?
    14·1 answer
  • Which of these is not a potential cause of data loss?
    7·2 answers
  • What is the problem with the code snippet below? public class Test { public static void main(String[] args) { System.out.println
    6·1 answer
  • Linela Insurance needs to hire twenty accountants immediately to support its accounts receivable process. The hiring and trainin
    7·1 answer
  • What feature, new to Windows Server 2012, provides the ability to find identical sets of data on a SAN-based storage array and r
    13·1 answer
  • Write a C function which takes three parameters which are the cost for an item in a grocery store, the quantity to buy, and the
    12·2 answers
  • Marissa is designing a web page that features lessons on how to build cabinets. how can she make the page most engaging for the
    7·1 answer
  • Monica is writing a paper, and it needs to contain a certain amount of words. What Word Online feature can she use?IndentingProo
    5·1 answer
Add answer
Login
Not registered? Fast signup
Signup
Login Signup
Ask question!