Dasturlash tillari va axborot-kommunikatsiya texnologiyalari 1-semestr
309
public Test(int i, int j) {
x=i; y=j;}
public void nom1(Test ob) {
if (x
if (y
x=-x; y=-y;}
public void chiq() {
Console.Write(x); Console.WriteLine(y);}
public static void Main(){
Test ob1=new Test(-5, 4);
Test ob2=new Test(-2, 3);
ob1.nom1(ob2); ob1.chiq(); }}
A) 5, -4
B) 4, 3
C) -4, -3
D) 2, -4
E) 2, -3
10. Dasturni ishga tushirganda ekranda qanday natija xosil bo‘ladi?
using System;
class Test{
public void Mref(ref int x, ref int y){
x = x + 2; y = y + x; }
public static void Main(){
Test ob = new Test();
int a, b; a = 0; b = 0;
for (int i = 1; i <= 5; i++) ob.Mref(ref a, ref b);
Console.Write(a +",");
Console.WriteLine(b);
}}
A) 0, 0
B) 2, 2
C) 10, 30
D) 8, 25
E) xatolik beradi