Question: Q 3 Write a C program that: Asks the user to enter two words. Prints the letters of the string backwards. The letters should be

Q3 Write a C program that:
Asks the user to enter two words.
Prints the letters of the string backwards.
The letters should be printed on the same line, not one per line.
The program produces output as shown below:
Please enter the first word: Blue
Please enter the second word: Dart
First word reversed: eulB traD
Q4 Write a C program that does the following:
Defines an integer array arr [20]={1,2,3,4,5,6,7,8};
Lists all pairs of numbers of consecutive numbers as shown in the sample output.
Uses for loops to solve the problem.
(1,2),(2,3),(3,4)(4,5),(5,6),(6,7)(7,8)
Q5 Write a C program that does the following:
Accepts a 1 to 10-digit number or -1 from the user in an infinite loop.
The program comes out of the infinite loop and exits if the user types -1
Sums the digits of the number.
Defines a function int sum_digits (int num) that accepts an integer and returns the sum of its digits.
Prints the sum of the digits.
Prints an output as shown below.
Please enter a number (1 to 10 digits) or -1 to exit: 12345
The sum of digits of 12345 is 15.
Please enter a number (1 to 10 digits) or -1 to exit: 5555
The sum of digits of 5555 is 20.
Please enter a number (1 to 10 digits) or -1 to exit: -1
Exiting the program.
Q6 Write a C program that does the following:
Accepts a 1 to 10-character word or "exit" from the user in an infinite loop.
The program comes out of the infinite loop and exits if the user types "exit".
Uses bubble sort to sort the characters in the user input.
Prints the sorted word.
Prints an output as shown below.
Please enter a word (1 to 10 characters) or 'exit' to quit: words
Sorted word: dorsw
Please enter a word (1 to 10 characters) or 'exit' to quit: characters
Sorted word: aaccehrrst
Please enter a word (1 to 10 characters) or 'exit' to quit: yellow
Sorted word: ellowy
Please enter a word (1 to 10 characters) or 'exit' to quit: exit
Exiting the program.
Q 3 Write a C program that: Asks the user to

Step by Step Solution

There are 3 Steps involved in it

1 Expert Approved Answer
Step: 1 Unlock blur-text-image
Question Has Been Solved by an Expert!

Get step-by-step solutions from verified subject matter experts

Step: 2 Unlock
Step: 3 Unlock

Students Have Also Explored These Related Programming Questions!