Answer:
string=""
while string not in {"Quit","quit","q"}:
string=input("Enter line to be reversed") #line of text will be entered
if string!="Quit" and string!="quit" and string!="q": #If quit is not entered
print("Reverse of line is : ")
print(string[::-1])
OUTPUT :
Enter line to be reversedThis code is in python language
Reverse of line is :
egaugnal nohtyp ni si edoc sihT
Enter line to be reversedHello world
Reverse of line is :
dlrow olleH
Enter line to be reversedquit
Explanation:In the above program, First a while loop is executed and checked if line of text is not 'quit', 'Quit' or 'q'. If condition is true, then loop is executed and in python any string or list can be traversed from end if step is given -1. Similarly line of text is accessed from the last element. If quit is entered, then the program will be broken out of the loop.
A bar code is a series of bars and spaces representing numbers or letters.
<h3><u>
Explanation:</u></h3>
A method that is used for the purpose of representing a data in the form of a picture or image that can be easily understood by the machine. It consists of many lines that has different widths and spaces. They either represent the letter or a number. These are mainly used for the representation of data in the machine understandable format.
For example an UPC-A bar codes has 12 numbers. The numbering system is represented by the first digit. The manufacturer will be represented by the next five digits in it. The product will be represented by the five digits following it. Check digit is represented in the last digit.
This program will the string array in the given format.
int main(void){
char arr[6];
int counter;
strcpy(arr[], "ARRAY");
for(counter=0; counter<6; counter++){
printf("%c", arr[counter]);
}
return 0;
)
Note: Do not forget to include all the necessary library that is needed to run this program.
You'll need a helper variable for this, so depending on your programming language, the solution becomes:
int helper;
helper = arr[i];
arr[i] = arr[j];
arr[j] = helper;