Professional Documents
Culture Documents
הצעה פתרון בגרות מדעי המחשב א קיץ 2013
הצעה פתרון בגרות מדעי המחשב א קיץ 2013
1
int c = 0;
int f = 4;
for (int i = 1; i <= f; i++)
{
Console.Write("Enter F : ");
int d = int.Parse(Console.ReadLine());
if (d == i || d < 3)
c = c + d;
else
Console.WriteLine("no");
}
Console.WriteLine(c);
c
0
Ii
If(d == i || d< 3)
4
1
2
True
2
2
5
False
"no"
3
7
False
"no"
4
4
True
6
"6"
2
// :
// : ' +' '*'
public static int GetSum(int a, int b, char ch)
{
if (ch == '+')
return a + b;
else
return a * b;
}
3
int cnt = 0; //
for (int i = 0; i < arr.Length; i++) //
if (arr[i] >= 10 && arr[i] < 100 || arr[i] <= -10 && arr[i] > -100)
cnt++; // 1 cnt
Console.WriteLine(cnt); // cnt
4
1
)If (last == 8
m3
m2
m1
n5
7
n4
1
n2
5
n3
3
n1
8
8
5
7
8
True
"***"
5
.
number
num2
num1
30
10
0
9
False
""$
1
40
False
""$
2
25
True
"*"
3
12
True
"*"
4
0
False
""$
( ) $$**$
( . ) 5 9 40 50 0
6
static public int A(int a, int b, int c)
{
int cnt = 0; //
if (a > 90) cnt++; // 90 cnt
if (b > 90) cnt++; // 90 cnt
if (c > 90) cnt++; // 90 cnt
return cnt; // cnt
}
static void Main(string[] args)
{
int cnt = 0; //
Console.Write("How much students ? : ");
int students = int.Parse(Console.ReadLine()); //
for (int i = 0; i < students; i++) // 0
{
Console.Write("Enter name : ");
string name = Console.ReadLine(); //
Console.Write("Enter grade #1 : ");
int a = int.Parse(Console.ReadLine()); //
if (A(a, b, c) == 3) // 90
{
Console.WriteLine(name); //
cnt++; // 1 cnt
}
}
Console.WriteLine(cnt);
}
unt
0
7
.
If (a[i] == a[i+1])
A[i]
A[I + 1]
b[count]
0
False
1
True
8
2
8
True
8
3
8
12
12
24
24
False
4
False
5
False
6
True
7
7
7
False
8,8,7,0,0,0,0,0 - b
a [1,2,3,4,5,6,7,8,9] .
9
// :
// 1 0
static public int A(int[,] arr, int k)
{
for (int i = 0; i < arr.GetLength(1); i++)
if (arr[k, i] <= 0)
return 0;
return 1;
}
// :
// 1 0
static public int B(int[,] arr, int j)
{
for (int i = 0; i < arr.GetLength(0); i++)
if (arr[i, j] <= 0)
return 0;
return 1;
}
static void Main(string[] args)
{
int cntA = 0; //
int cntB = 0; //
for (int i = 0; i < 45; i++) // 0 45
if (A(arr, i) == 1) //
cntA++; // 1 cntA
for (int i = 0; i < 42; i++) // 0 42
if (B(arr, i) == 1) //
cntB++; // 1 cntB
if (cntA > cntB) // cntA cntB
Console.WriteLine("yes"); // yes
else //
Console.WriteLine("no"); // no
}
11
// :
// : 2
static public double A(double a, double b)
{
if (a < b)
return b + (a / 2);
return a + (b / 2);
}
// :
// :
static public double B(int books)
{
Console.Write("Enter price book #1 : ");
double a = double.Parse(Console.ReadLine());
Console.Write("Enter price book #2 : ");
double b = double.Parse(Console.ReadLine());
if (books == 3)
{
Console.Write("Enter price book #3 : ");
double c = double.Parse(Console.ReadLine());
return sum2max(a, b, c);
}
return A(a, b);
}
static void Main(string[] args)
{
for (int i = 0; i < 142; i++) // 0 142
{
Console.Write("How much books : ");
int books = int.Parse(Console.ReadLine()); //
Console.WriteLine("How much to pay {0}", B(books)); //
}
}