You are on page 1of 5

132 ‫עמוד‬

5‫בן ארי מימון – י‬

33 ‫שאלה‬:

class Program
{
static void Main(string[] args)
{
int number, totaleven = 0;
for (int i = 0; i < 30; i++)
{
Console.WriteLine("please enter a number");
number = int.Parse(Console.ReadLine());
if ((number >= 10) && (number < 100) && (number % 2
== 0))
totaleven = totaleven + number;

}
Console.WriteLine(totaleven);
}
}
}
34 ‫שאלה‬:

class Program
{
static void Main(string[] args)
{
int n, total = 1;
{
Console.WriteLine("please enter a number");
n = int.Parse(Console.ReadLine());
for (int i = 1; i <= n; i++)
{
total = total * i;
}
Console.WriteLine("n1 is: " + total);
}
}
}
}

35 ‫שאלה‬
35 ‫שאלה‬

class Program
{
static void Main(string[] args)
{
int n, zoogiem = 0, notzoogiem = 0, diffrance = 0;
{
Console.WriteLine("please enter a number");
n = int.Parse(Console.ReadLine());
for (int i = 1; i <= n; i++)
{
if ((i % 2) == 0)
{
zoogiem = zoogiem + i;
}
else
{
notzoogiem = notzoogiem + i;
}
diffrance = zoogiem - notzoogiem;

}
Console.WriteLine("the odd numbers are " +
notzoogiem);
Console.WriteLine("the even numbers are " +
zoogiem);
Console.WriteLine("the diffrance between the numbers
is " + diffrance);
}
}
}
}
36 ‫שאלה‬

class Program
{
static void Main(string[] args)
{
int n1, n2, total = 0, mahpela = 1;
{
Console.WriteLine("please enter the first (smaller)
number");
n1 = int.Parse(Console.ReadLine());
Console.WriteLine("please enter the second (bigger)
number");
n2 = int.Parse(Console.ReadLine());
for (int i = n1; i < n2; i++)
{
total = total + i;
mahpela = mahpela * i;
}
Console.WriteLine("the mahpela of the numbers is: "
+ mahpela);
Console.WriteLine("the total of the numbers is: " +
total);
}
}
}
}
38 ‫תרגיל‬

class Program
{
static void Main(string[] args)
{
int basis, maarih, total = 1;
{
Console.WriteLine("please enter the basis of the
hezka");
basis = int.Parse(Console.ReadLine());
Console.WriteLine("please enter the maarih of the
hezka");
maarih = int.Parse(Console.ReadLine());
for (int i = 0; i < maarih; i++)
{
total *= basis;
}
Console.WriteLine("the total is " + total);
}
}
}
}

You might also like