Professional Documents
Culture Documents
שיעורי בית בן ארי מימון מחרוזות
שיעורי בית בן ארי מימון מחרוזות
שיעורי בית בן ארי מימון מחרוזות
1 משימה
class Program
{
static void Main(string[] args)
{
string max = "";
string n = Console.ReadLine();
if (n.Length > max.Length)
{
max = n;
}
for (int i = 0; i < 9; i++)
{
n = Console.ReadLine();
if (n.Length > max.Length)
{
max = n;
}
}
Console.WriteLine(max);
}
}
}
2 שאלה
class Program
{
static string Sofer(string mahrozet)
{
if (mahrozet.Length <= 20)
{
string newmassage = "";
for (int i = 0; i < mahrozet.Length; i++)
{
if (mahrozet[i] != '*')
{
newmassage += mahrozet[i];
newmassage += mahrozet[i];
}
}
return newmassage;
}
return "too big";
}
static void Main(string[] args)
{
string check;
Console.WriteLine("enter a mahrozet");
string B = Console.ReadLine();
check = Sofer(B);
Console.WriteLine(check);
while (check.Length > 0)
{
Console.WriteLine("enter a mahrozet");
B = Console.ReadLine();
check = Sofer(B);
Console.WriteLine(check);
}
}
}
}
4 שאלה:
class Program
{
static void Tester(string a1, string a2)
{
int place = -1;
if ((a1.Length <= 100) && (a2.Length <= 3))
{
for (int i = 0; i < a1.Length; i++)
{
if ((a2[0]) == (a1[i]) && (a1[i + 1]) == (a2[1])
&& (a1[i + 2]) == (a2[2]))
{
place = i;
}
}
}
Console.WriteLine(place); ;
}
static void Main(string[] args)
{
string b, c;
b = Console.ReadLine();
c = Console.ReadLine();
Tester(b, c);
}
}
}
5 שאלה
class Program
{