class CheckCapitalChar
{
public static string CountCapital(string str)
{
StringBuilder sb = new StringBuilder();
for (int i = 0; i < str.Length - 1; i++)
{
char ch = str[i];
if (char.IsUpper(ch))
{
sb.Append(ch);
}
}
return sb.ToString();
}
public static void Main()
{
Console.WriteLine("Enter the string");
string str = Console.ReadLine();
string result = CountCapital(str);
Console.WriteLine(result);
Console.ReadLine();
}
}
Output:
No comments:
Post a Comment