namespace WinFormsApp2
{
public partial class Form1 : Form
public Form1()
InitializeComponent();
}
private void Button1_Click(object sender, EventArgs e)
var words = textBox1.Text.Split(' ');
var min = words[0].Length;
for (var i = 1; i < words.Length; i++)
if (words[i].Length < min)
min = words[i].Length;
MessageBox.Show($@"Длина самого короткого слова: {min}");
Copyright © 2024 SCHOLAR.TIPS - All rights reserved.
Answers & Comments
namespace WinFormsApp2
{
public partial class Form1 : Form
{
public Form1()
{
InitializeComponent();
}
private void Button1_Click(object sender, EventArgs e)
{
var words = textBox1.Text.Split(' ');
var min = words[0].Length;
for (var i = 1; i < words.Length; i++)
{
if (words[i].Length < min)
{
min = words[i].Length;
}
}
MessageBox.Show($@"Длина самого короткого слова: {min}");
}
}
}