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
Dinesh B
NA
117
40.7k
Reverse the individual words in a sentence
Nov 12 2015 10:57 PM
By using for loop and if clause we can reverse the individual words in a sentence.
This program is in c#
Class Program
{
static void main(string[] args)
{
Int count=0,i,j;
Console.writeline("Enter the string");
String s = convert.Tostring(console.readline());
for(i=0;i<s.length;i++)
{
if(s[i]!=' ')
{
Count ++;
}
else
{
for(j =i-1;j>=i-count;j--)
{
console.write(s[j]);
}
Count =0;
Console.write(" ");
}}
Console.readline();
}}}
Note : while entering the words give a space after the last word.
The o/p will be correctly display
Reply
Answers (
8
)
How to design a keypad in C#?
export label values in excel