// Har bir sonning raqamlar yig'indisini ekranga chiqarish




Download 0,9 Mb.
bet4/8
Sana18.05.2024
Hajmi0,9 Mb.
#242341
1   2   3   4   5   6   7   8
Bog'liq
7ish00

// Har bir sonning raqamlar yig'indisini ekranga chiqarish

for (int i = 0; i < N; i++) {

System.out.println((i + 1) + "-sonning raqamlar yig'indisi: " + yigindilar.get(i));

}

}

}

}











package javafx;


import java.io.*;

import java.net.*;


public class Server {

public static void main(String[] args) throws IOException {

// Server soketini yaratish

try (ServerSocket serverSocket = new ServerSocket(5000)) {

System.out.println("Server ishga tushdi...");

while (true) {

try (Socket clientSocket = serverSocket.accept()) {

System.out.println("Klient ulandi...");


// Klientdan diagonallarni qabul qilish

BufferedReader input = new BufferedReader(new InputStreamReader(clientSocket.getInputStream()));

double d1 = Double.parseDouble(input.readLine());

double d2 = Double.parseDouble(input.readLine());

System.out.println("Qabul qilingan diagonallar: d1 = " + d1 + ", d2 = " + d2);


// Rombning yuzasini hisoblash

double yuza = (d1 * d2) / 2;


// Klientga yuzani yuborish

PrintWriter output = new PrintWriter(clientSocket.getOutputStream(), true);

output.println(yuza);

System.out.println("Rombning yuzasi: " + yuza + " klientga yuborildi.");

}

}

}

}

}




package javafx;


import java.io.*;

import java.net.*;


public class Server {

public static void main(String[] args) throws IOException {

// Server soketini yaratish

try (ServerSocket serverSocket = new ServerSocket(5000)) {


Download 0,9 Mb.
1   2   3   4   5   6   7   8




Download 0,9 Mb.

Bosh sahifa
Aloqalar

    Bosh sahifa



// Har bir sonning raqamlar yig'indisini ekranga chiqarish

Download 0,9 Mb.