Java tili sintaksisi, uning leksik asosi va tarkibiy tuzilishi. O’zgarmaslar, Ifodalardagi amallar doir topshiriqlar



Download 27,34 Kb.
Sana31.12.2021
Hajmi27,34 Kb.
#258865
Bog'liq
Amaliyot Misolar


Java dasturini o’rnatish va uning imkoniyatlari.Java tili sintaksisi, uning leksik asosi va tarkibiy tuzilishi. O’zgarmaslar, Ifodalardagi amallar doir topshiriqlar
1.Ikkita haqiqiy a va b sonlari berilgan bo´lsin. Ularning yig‘indisi, ayirmasi va ko‘paytmasini toping.


Kirivchi malumot

Chiquvchi malumot

1 2

Yig’indi: 3

Ayirma : -1



package pack1;

import java.util.Scanner;

public class Misol2 {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

double a, b;

a = sc.nextDouble();

b = sc.nextDouble();

System.out.println(a + b);

System.out.println(a - b);

System.out.println(a * b);

}

}


2. Ikkita haqiqiy a va b sonlari berilgan bo´lsin. Ularning o’rta arifmetig toping.




Kirivchi malumot

Chiquvchi malumot

6 4

Natija : 5






package pack1;

import java.util.Scanner;

public class Misol2 {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

double a, b;

a = sc.nextDouble();

b = sc.nextDouble();

System.out.println((a + b) / 2);

}

}



3. Ikkita haqiqiy a va b musbat sonlari berilgan bo´lsin. Ularning o’rta garmonik qiymatini toping.


Kirivchi malumot

Chiquvchi malumot

2 4

Natija : 2.6666






package pack1;

import java.util.Scanner;

public class Misol3 {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

double a, b, h;

a = sc.nextDouble();

b = sc.nextDouble();

h=1./2*(1./(a)+1./(b));

System.out.println(h);

}

}

4.Tomonlari a va b haqiqiy musbat sonlar bo’lgan to’g’ri to’rtburchakning yuzini toping.




Kirivchi malumot

Chiquvchi malumot

6 2

Natija: 12

package pack1;

import java.util.Scanner;

public class Misol4 {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

double a, b, s;

a = sc.nextDouble();

b = sc.nextDouble();

s = a * b;

System.out.println(s);

}

}

5. Koordinatalari (x1, y1) va (x2, y2) bo‘lgan ikki nuqta orasidagi masofani toping.




Kirivchi malumot

Chiquvchi malumot

0 0 1 1

Natija: 1.4142

package pack1;

import java.util.Scanner;

public class Misol5 {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

double x1, x2, y1, y2, d;

x1 = sc.nextDouble();

x2 = sc.nextDouble();

y1 = sc.nextDouble();

y2 = sc.nextDouble();

d = Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2));

System.out.println(d);

}

}

6. Uchburchak uchlarining koordinatalari orqali berilgan bo‘lsin. Uning



perimetri va yuzini toping.


Kirivchi malumot

Chiquvchi malumot

0 0 1 0 1 1

Perimetri : 3.4142

Yuzi : 0.5



package pack1;

import java.util.Scanner;

public class Misol6 {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

double x1, x2, y1, y2, x3, y3, d1, d2, d3 , P , S ;

x1 = sc.nextDouble();

x2 = sc.nextDouble();

x3 = sc.nextDouble();

y1 = sc.nextDouble();

y2 = sc.nextDouble();

y3 = sc.nextDouble();

d1 = Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2));

d2 = Math.sqrt(Math.pow((x3 - x2), 2) + Math.pow((y3 - y2), 2));

d3 = Math.sqrt(Math.pow((x3 - x1), 2) + Math.pow((y3 - y1), 2));

P = d1 + d2 + d3;

S = Math.sqrt((P / 2 - d1) * (P / 2 - d2) * (P / 2 - d3) * P / 2);

System.out.println("Perimetri=" + P + " " + "Yuzasi=" + S);

}

}

7.To’g’ri burchakli uchburchakning katetlari a va b haqiqiy musbat sonlardan tashkil topgan. Berilgan uchburchakning gipotenuzasini toping.




Kirivchi malumot

Chiquvchi malumot

0 0 1 1

Natija: 1.4142

package pack1;

import java.util.Scanner;

public class Misol7 {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

double x1, x2, y1, y2, c;

x1 = sc.nextDouble();

x2 = sc.nextDouble();

y1 = sc.nextDouble();

y2 = sc.nextDouble();

c = Math.sqrt(Math.pow((x2 - x1), 2) + Math.pow((y2 - y1), 2));

System.out.println("Kateti=" + c);

}

}

8. Uchta haqiqiy a va b va c sonlari berilgan bo´lsin. Ularning qiymatlarini almashtiring.




Kirivchi malumot

Chiquvchi malumot

5 6 9

Natija : 6 9 5

package pack1;

import java.util.Scanner;

public class Misol8 {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

double a, b, c, t;

a = sc.nextDouble();

b = sc.nextDouble();

c = sc.nextDouble();

t = a;


a = b;

b = c;


c = t;

System.out.println(a + " " + b + " " + c);

}

}

9.Tomoni a ga teng bo’lgan kvadratning yuzini va perimetrini toping.




Kirivchi malumot

Chiquvchi malumot

6

Yuzi: 36

Perimetri: 24







package pack1;


import java.util.Scanner;
public class Misol9 {
public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int a, s = 1, p = 1;

a = sc.nextInt();

s = a * a;

p = 4 * a;


System.out.println("Yuzasi=" + s + " " + "Perimetri=" + p);

}

}


10.y = kx + b funksiyaning qiymatini hisoblang.Bu yerda k,x va b haqiqiy sonlar. a haqiqiy son.


Kirivchi malumot

Chiquvchi malumot

6 1 5

Natija : 11





package pack1;


import java.util.Scanner;
public class Misol10 {
public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

double y, a, b, x;

a = sc.nextDouble();

b = sc.nextDouble();

x = sc.nextDouble();

y = a * x + b;

System.out.println(y);

}

}

11. Tomonlari a va b haqiqiy musbat sonlar bo’lgan to’g’ri to’rtburchakning perimetrini toping.




Kirivchi malumot

Chiquvchi malumot

6 1

Perimetr: 14





package pack1;


import java.util.Scanner;
public class Misol11 {
public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int a, b, s = 0;

a = sc.nextInt();

b = sc.nextInt();

p = a + b;

System.out.println(p);
}

}
12. Tomoni a haqiqiy soniga teng bo’lgan muntazam uchburchakning perimetrini toping.




Kirivchi malumot

Chiquvchi malumot

6

Perimetr: 18





package pack1;


import java.util.Scanner;
public class Misol12 {
public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int a, p = 0;

a = sc.nextInt();

p = a + a + a;

System.out.println(p);

}

}

13.To’g’ri burchakli parallelopipedning tomonlari mos ravishda a,b va c haqiqiy sonlarga teng.Uning hajmini toping.




Kirivchi malumot

Chiquvchi malumot

8 4 6

Natija : 192





package pack1;


import java.util.Scanner;
public class Misol13 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);

int a, b, c, v = 1;

a = sc.nextInt();

b = sc.nextInt();

c = sc.nextInt();
v = a * b * c;

System.out.println(v);

}

}
14. To’g’ri burchakli parallelopipedning tomonlari mos ravishda a,b va c haqiqiy sonlarga teng.Uning perimetrini toping.




Kirivchi malumot

Chiquvchi malumot

8 4 6

Perimetr: 72





package pack1;


import java.util.Scanner;
public class Misol14 {
public static void main(String[] args) {
Scanner sc = new Scanner(System.in);

int a, b, c, p = 0;

a = sc.nextInt();

b = sc.nextInt();

c = sc.nextInt();
p = 4 * a + 4 * b + 4 * c;

System.out.println(p);

}

}
15. To’g’ri burchakli parallelopipedning tomonlari mos ravishda a,b va c haqiqiy sonlarga teng.Uning to’la yuzasini toping.




Kirivchi malumot

Chiquvchi malumot

8 4 6

To’la uzi 208





package pack1;


import java.util.Scanner;
public class Misol15 {
public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int a, b, c, s = 1;

a = sc.nextInt();

b = sc.nextInt();

c = sc.nextInt();


s = 2 * (a * b + b * c + a * c);

System.out.println(s);


}

}
16.Radiusi r haqiqiy soniga teng bo’lgan aylananing uzunligini hisoblang.




Kirivchi malumot

Chiquvchi malumot

6.0

Natija: 37.68





package pack1;


import java.util.Scanner;
public class Misol16 {
public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int r;

double l;



r = sc.nextInt();
l = Math.PI * r;

System.out.println(l);


}

}

17.Radiusi r haqiqiy soniga teng bo’lgan doiraning yuzini hisoblang.




Kirivchi malumot

Chiquvchi malumot

6.0

Natija: 113.04





package pack1;


import java.util.Scanner;
public class Misol17 {
public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int r;

double s;



r = sc.nextInt();
s = Math.PI * r * r;

System.out.println(s);

}

}
18.Tomoni a haqiqiy soniga teng bo’lgan muntazam uchburchakning yuzasini toping.




Kirivchi malumot

Chiquvchi malumot

6.0

Natija: 15.58






package pack1;


import java.util.Scanner;
public class Misol18 {
public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int a;

double s;



a = sc.nextInt();
s = Math.sqrt(3) * a * a / 4;

System.out.println(s);

}

}

19. y = kx + b funksiyadan b ning qiymqtini toping.Bu yerda y,k va x haqiqiy sonlar.




Kirivchi malumot

Chiquvchi malumot

6 2 3

Natija : 0





package pack1;


import java.util.Scanner;
public class Misol19 {
public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int k, x, y;

double b;

k = sc.nextInt();

x = sc.nextInt();

y = sc.nextInt();

b = y - k * x;

System.out.println(b);
}

}
20. Haqiqiy a ,b, c , d va f sonlari berilgan bo´lsin. Ularning qiymatlarini mos ravishda almashtiring.




Kirivchi malumot

Chiquvchi malumot

6 5 9 1 3

5 9 1 3 6





package pack1;


import java.util.Scanner;
public class Misol20 {
public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int a, b, c, d, f, t;
a = sc.nextInt();

b = sc.nextInt();

c = sc.nextInt();

d = sc.nextInt();

f = sc.nextInt();

t = a;


a = b;

b = c;


c = d;

d = a;


System.out.println(a + " " + b + " " + c + " " + d + " " + f);
}

}

21.Tomonlari a va b ga balandligi esa h ga teng bo’lgan trapetsiyaning yuzini toping.




Kirivchi malumot

Chiquvchi malumot

6 2 2

6






package pack1;


import java.util.Scanner;

public class Misol21 {


public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int a,b,h;

double s;

a = sc.nextInt();

b = sc.nextInt();

h = sc.nextInt();

s=(a+b)*h/2;

System.out.println(s);

}

}
22.Tomoni a haqiqiy soniga teng bo’lgan muntazam oltiburchakning yuzasini toping.




Kirivchi malumot

Chiquvchi malumot

6 2 2

6





package pack1;


import java.util.Scanner;
public class Misol22 {
public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int a;

double s;



a = sc.nextInt();
s = Math.sqrt(3) * a * a / 2;

System.out.println(s);


}

}
23.Tomonlari m , n , k va l ga teng bo’lgan ko’pburchakning perimetrini toping.




Kirivchi malumot

Chiquvchi malumot

6 2 2

6





package pack1;


import java.util.Scanner;
public class Misol23 {
public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int m, n, k, l, p;
m = sc.nextInt();

n = sc.nextInt();

k = sc.nextInt();

l = sc.nextInt();


p = m + n + k + l;

System.out.println("Perimetri=" + p);


}

}
24.Parallelopipedning tomonlari a,b,c berilgan. Uning hajmi va to’la sirtini toping.


package pack1;
import java.util.Scanner;
public class Misol24 {
public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int a, b, c, s, p;

a = sc.nextInt();

b = sc.nextInt();

c = sc.nextInt();

p = 4 * (a + b + c);

s = 2 * (a * b + b * c + a * c);

System.out.println("Perimetri=" + p + "Yuzasi" + s);
}

}
25.Ikkita bir xil ishorali a va b sonlari berilgan. Ularning o’rta geometrigini toping.


package pack1;

import java.util.Scanner;

public class Misol25 {

public static void main(String[] args) {

Scanner sc = new Scanner(System.in);

int a, b, s;

a = sc.nextInt();

b = sc.nextInt();

s = (a + b) / 2;

System.out.println(s);



}

}
Download 27,34 Kb.

Do'stlaringiz bilan baham:




Ma'lumotlar bazasi mualliflik huquqi bilan himoyalangan ©www.hozir.org 2024
ma'muriyatiga murojaat qiling

kiriting | ro'yxatdan o'tish
    Bosh sahifa
юртда тантана
Боғда битган
Бугун юртда
Эшитганлар жилманглар
Эшитмадим деманглар
битган бодомлар
Yangiariq tumani
qitish marakazi
Raqamli texnologiyalar
ilishida muhokamadan
tasdiqqa tavsiya
tavsiya etilgan
iqtisodiyot kafedrasi
steiermarkischen landesregierung
asarlaringizni yuboring
o'zingizning asarlaringizni
Iltimos faqat
faqat o'zingizning
steierm rkischen
landesregierung fachabteilung
rkischen landesregierung
hamshira loyihasi
loyihasi mavsum
faolyatining oqibatlari
asosiy adabiyotlar
fakulteti ahborot
ahborot havfsizligi
havfsizligi kafedrasi
fanidan bo’yicha
fakulteti iqtisodiyot
boshqaruv fakulteti
chiqarishda boshqaruv
ishlab chiqarishda
iqtisodiyot fakultet
multiservis tarmoqlari
fanidan asosiy
Uzbek fanidan
mavzulari potok
asosidagi multiservis
'aliyyil a'ziym
billahil 'aliyyil
illaa billahil
quvvata illaa
falah' deganida
Kompyuter savodxonligi
bo’yicha mustaqil
'alal falah'
Hayya 'alal
'alas soloh
Hayya 'alas
mavsum boyicha


yuklab olish