משעמם לי....אז כתבתי את הפיתרון לבחינת הגרות :)
שאלה 1-
int a, b, c;
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
c = int.Parse(Console.ReadLine());
if ((a + b == 200) || (a + c == 200) || (b + c == 200))
ConsoleLine("YES!");
else
ConsoleLine("NO!!");
Console.Read();
מי שהתחכם ועשה עם....משתנה בוליאני....טוב...מה אני אגיד לו?....
שאלה 2 -
הפלט יהיה ..... עבור m1=2 , m2=3
היה קשה? לא....
שאלה 3 -
נתון // int[] arr = new int[51];
int mone1=0,mone7=0;
for (int i = 0; i < arr.Length; i++)
{
if (arr[i] == 1)
mone1++;
else
mone7++;
}
if (mone1 > mone7)
ConsoleLine("1!");
else
{
ConsoleLine("1!");
}
Console.Read();
היה נורא? לא......
שאלה 4
א)הפלט יהיה 55
ב)כל זוג ספרות זהות.....לדוגמא 11 22 33 44 55 66 77 88 99
ג) 1 - עבור הקלט....13 או 31
2 - עבור הקלט 44
שאלה 5-
int a,b;
int sum,piece;
for (int i = 0; i < 38; i++)
{
a = int.Parse(Console.ReadLine());
b = int.Parse(Console.ReadLine());
sum = a + b;
ConsoleLine("The sum is: " + sum);
if (b == 0)
ConsoleLine("Indivisible");
else
{
piece = a / b;
ConsoleLine("The ... is: " + piece);
}
}
Console.Read();
שאלה 6 - לא עשיתי..היא חופרת XD
שאלה 7 -
א) הפלט עבור SUM יהיה 3
ב) דוגמא למערך......(משאמל לימין) - 8 9 10 11 12 13 14 16 17 19 7
ג) לאחר השינוי.... SUM יהיה 3
שאלה 8...לא היה לי כוח לכתוב.
שאלה 9 -
public static int Check(int[,]ma,int a, int b)
{
int sum1 = 0, sum2 = 0;
for (int i = 0; i < ma.GetLength(0); i++)
{
sum1 += ma[a, i];
}
for (int i = 0; i < ma.GetLength(1); i++)
{
sum2 += ma[i, b];
}
if (sum1 == sum2)
return 1;
else
return 0;
}
static void Main(string[] args)
{
int[,] arr = new int[5, 5];
int mone = 0;
for (int i = 0; i < arr.GetLength(0); i++)
{
for (int j = 0; j < arr.GetLength(1); j++)
{
arr[i, j] = int.Parse(Console.ReadLine());
}
}
for (int i = 0; i < arr.GetLength(0); i++)
{
for (int j = 0; j < arr.GetLength(1); j++)
{
(אין צורך לקלוט למערך פשוט התוכנה צריכה שיקלטו לתוכה נתונים....אי אפשר פשוט לאמר לה "נתון מערך עם מספרים"
)