Answer to Question #11135 in C# for vikash kumar rai

Question #11135
write a c# program which will accept a text from user and remove the extra spaces within there
1
Expert's answer
2012-06-22T08:36:27-0400
using System;
using System.Collections.Generic;
using
System.Linq;
using System.Text;

namespace Question11135
{

class Program
{
static void Main(string[] args)

{
string inputstr = "";
string outputstr =
"";
inputstr = Console.ReadLine();
for (int i = 0;
i < inputstr.Length; i++) {
if (inputstr[i] != ' ')
{
outputstr += inputstr[i];

}
}
Console.Write(outputstr);

Console.ReadLine();
}
}
}

Need a fast expert's response?

Submit order

and get a quick answer at the best price

for any assignment or question with DETAILED EXPLANATIONS!

Comments

No comments. Be the first!

Leave a comment

LATEST TUTORIALS
APPROVED BY CLIENTS