TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
elmo monster
NA
1
14.2k
C# program to reverse each word of a sentence separately?
Apr 12 2014 1:19 PM
a C# program to reverses each word in a sentence except these punctuation marks (? ! . ,)
example: (input) this is john, who are you?
(output) sith si nhon, ohw era uoy?
_______________________________________...
here's my code which reverses punctuation marks too and removes the space character in the output.. :,(
string str = Console.ReadLine();
string strrev = "";
foreach (var word in str.Split(' '))
{
string temp = "";
foreach (var ch in word.ToCharArray())
{
temp = ch + temp;
}
strrev = strrev + temp + "";
}
Console.WriteLine(strrev);
Console.ReadLine();
Reply
Answers (
4
)
Thread UL
error of reading data in socket programming