Computer Science, asked by mohammadadnan7, 4 months ago

4. Write a program in Java to accept a name containing three words and display the
surname first, followed by the first and middle names.
Sample Input: MOHANDAS KARAMCHAND GANDHI
Sample output: GANDHI MOHANDAS KARAMCHAND​

Answers

Answered by parvewn2010
1

Answer:

Sample Input : Mohandas Karamchand Gandhi

Sample Output : Gandhi Mohandas Karamchand

Hint : Here , the last word of the name is placed first and the first word of the name is placed in the middle.

Answered by TalaKishor
3

The answer is given in the image:

Attachments:
Similar questions