Настя456654123321
07.01.2021 12:03

составьте программу которая обеспечивает ввод текста на экран по смыслу текста самая верхняя строка слева самая верхняя строка справа,самая верхняя строка посередине,самая нижняя строка слева, самая нижняя строка слева,строка в центре справа,строка в центре посередине

Нажмите на рекламу ниже и сразу увидите ответ
Популярные вопросы:
Ответ:
Xeitm
04.11.2021 21:00

Объяснение:

зык — Java

1.

import java.util.Scanner;

public class Znanija {

  public static void main(String args[]) {

    double x, y;

     

    Scanner input = new Scanner(System.in);

     

    System.out.println("Enter the value of \"x\": ");

    x = input.nextInt();

     

    y = (2.7*x*3)+(0.23*x*2)-1.4;

     

    System.out.println("\nThe value of \"y\" is: " + y);

  }

}

2.

Похоже здесь опечатка: 1 фунт = 453.592граммов.

import java.util.Scanner;

public class Znanija {

  public static void main(String args[]) {

    double kilogram, lb;

     

    Scanner input = new Scanner(System.in);

     

    System.out.println("Enter your weight in kilograms: ");

    kilogram = input.nextInt();

     

    lb = (kilogram*1000)/453.592;

     

    System.out.println("\nYou weigh " + lb +  " pounds.");

  }

}

3.

import java.util.Scanner;

public class Znanija {

  public static void main(String args[]) {

    int number;

     

    Scanner input = new Scanner(System.in);

     

    System.out.println("Enter the number: ");

    number = input.nextInt();

     

    if(number%2 == 0) {

        System.out.println("\nThe number is even!");

    }

     

    else {

        System.out.println("\nThe number is odd!");

    }

  }

}

4.

public class Znanija {

  public static void main(String args[]) {

    int number = 1;

     

   for(; number<100; number++) {

       if(number%10 == 0) {

           System.out.println(number);

       }

   }

  }

}

5.

import java.util.Scanner;

public class Znanija {

  public static void main(String args[]) {

    int[] numbers = new int[4];

    int first, second, third, fourth;

    int min, max;

    min = max = numbers[0];

    Scanner input = new Scanner(System.in);

     

    System.out.println("Enter the first number: ");

    first = input.nextInt();

     

    System.out.println("\nEnter the second number: ");

    second = input.nextInt();

     

    System.out.println("\nEnter the third number: ");

    third = input.nextInt();

     

    System.out.println("\nEnter the fourth number: ");

    fourth = input.nextInt();

     

   numbers[0] = first;

   numbers[1] = second;

   numbers[2] = third;

   numbers[3] = fourth;

   

  //Сортитовка пузырьком

for (int i = 0; i < numbers.length; i++) {

//Новая индексная переменная j, которая в дальнейшем будет проверять, ни больше ли неё следующая цифра

         for (int j = 0; j < numbers.length - i - 1; j++) {

//Проверка

             if (numbers[j] > numbers[j + 1]) {

//Обмен значениями между  не сортированными элементами

                 int temp = numbers[j];

                 numbers[j] = numbers[j + 1];

                 numbers[j + 1] = temp;

             }

         }

     }

 

System.out.println("\nThe numbers with the maximum and minimum values, respectively: " + numbers[3] + ", " + numbers[0]);

int bufMin = numbers[0], bufMax = numbers[3];

int difference = bufMax-bufMin;

System.out.println("The difference between these numbers: " + difference);

   

  }

}

0,0(0 оценок)
Ответ:
den222276
08.12.2022 15:07
//Microsoft (R) C/C++ Optimizing Compiler Version 19.00.23506 for x64

#include <vector>
#include <iostream>
#include <algorithm>
#include <utility>
#include <random>
#include <iterator>
using namespace std;

int main()
{
    mt19937 gen{ random_device()() };
    uniform_int_distribution<> uid(1, 100);
    vector<vector<int>> v2d(3, vector<int>(3));
    int max_i;
    for_each(v2d.begin(), v2d.end(), [&max_i, &uid, &gen](vector<int>& v) {
            generate(v.begin(), v.end(), [&uid, &gen]() { return uid(gen); });
            max_i = max(*max_element(v.begin(), v.end()), max_i);
        });
    cout << endl;
    v2d.erase(remove_if(v2d.begin(), v2d.end(), [&max_i](vector<int>& v) {
        return find(v.begin(), v.end(), max_i) != v.end();
    }), v2d.end());
    for (const auto& i : v2d)
    {
        copy(i.begin(), i.end(), ostream_iterator<int>(cout, " "));
        cout << endl;
    }
}
0,0(0 оценок)
Полный доступ
Позволит учиться лучше и быстрее. Неограниченный доступ к базе и ответам от экспертов и ai-bota Оформи подписку
logo
Начни делиться знаниями
Вход Регистрация
Что ты хочешь узнать?
Спроси ai-бота