Write a C# program to find the longest word in a string
- برمجة سي شارب
- برمجة
- 2021-05-15
- MarwaMohammed
الأجوبة
using System;
public class Exercise24
{
public static void Main()
{
string line = "Write a C# Sharp Program to display the following pattern using the alphabet.";
string[] words = line.Split(new[] { " " }, StringSplitOptions.None);
string word = "";
int ctr = 0;
foreach (String s in words)
{
if (s.Length > ctr)
{
word = s;
ctr = s.Length;
}
}
Console.WriteLine(word);
}
}أسئلة مشابهة
القوائم الدراسية التي ينتمي لها السؤال
