WAP to accept a string and print its 1st character and last character.
I'll mark you brainliest.. plz help me out guys
Answers
Answered by
0
Answer:
Given a string, the task is to print the first and last character of each word in a string.
Examples:
Input: Geeks for geeks
Output: Gs fr gs
Input: Computer applications
Output: Cr as
Recommended: Please try your approach on {IDE} first, before moving on to the solution.
Approach
Run a loop from the first letter to the last letter.
Print the first and last letter of the string.
If there is a space in the string then print the character that lies just before space and just after space.
Explanation:
Hope it helps you
Answered by
1
Answer:
Approach
Run a loop from the first letter to the last letter.
Print the first and last letter of the string.
If there is a space in the string then print the character that lies just before space and just after space.
Attachments:
Similar questions