Answer:
1st question:
Utilize k, d, and s as variables to read three distinct inputs: an integer, a float, and a string, respectively. Print these variables in reverse order on one line, ensuring exactly one space separates each. On a second line, print them in their original sequence, with one space in between.
Solution:
In Python:
k = input() # prompts user to enter k, an integer value
d = input() # prompts user to provide d, a float value
s = input() # prompts user to input s, a string
print (s, d, k) # displays the variable values in reverse order
print (k, d, s)# displays the variable values in the original order
In C++:
#include <iostream> // for input-output functions
using namespace std; // to identify objects like cin and cout
int main() { // start of main function
int k; // declare an int variable for the integer value
float d; // declare a float variable for the float value
string s; // declare a string variable for string input
cin >> k >> d >> s; // reads the values for k, d, and s
cout << s << " " << d << " " << k << endl; // displays the variables in reverse order
cout << k << " " << d << " " << s << endl; } // displays the variables in their original order
Explanation:
2nd question:
You would want users of your program to enter a customer's last name. Formulate a statement that prompts the user with "Last Name:" and assigns the input to a string variable named last_name.
Solution:
In Python:
last_name = input("Last Name:")
# The input function captures input from the user and assigns it to last_name variable
In C++:
string last_name; // declare a string variable called last_name
cout<<"Last Name: "; // prompts user to input last name through this message Last Name:
cin>>last_name; // gathers and assigns the provided value to the last_name variable
The provided programs along with their outputs are included.