Print string in Short on C#

Shubham
Posted by Shubham under C# category on | Points: 40 | Views : 1588
this prog will help u to print your name in short form.....


using System;
class shortt
{
public static void Main()
{
int g=0;
string name = Console.ReadLine();
Console.Write(name[0]);
int m = name.Length;
for (int i = 1; i < m; i++)
{
if(name[i]== ' ')
{
Console.Write("."+name[i+1]);
g=i;
}
}
for(int k=g+2;k<m;k++)
{
Console.Write(name[k]);

}
Console.ReadLine();
}
}

Comments or Responses

Login to post response