Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Создайте программу, которая вычислит выражение 20ˣ⅓+158² и выведет результат на экран.
- /*class Main {
- public static void main (String [] args){
- double slag1 = 20.0*(1.0/3.0);
- int slag2 = 158*158;
- double result = slag1 + slag2;
- System.out.println(slag1 + " + " + slag2 + " = " + result);
- }
- }*/
- //В переменной n хранится двузначное число. Создайте программу, вычисляющую и выводящую на экран сумму цифр n.
- /*class Main {
- public static void main (String [] args) {
- int n = 89;
- int slag1 = (int) n/10;
- int slag2 = (int) n%10;
- System.out.println(slag1 + " + " + slag2 + " = " + n);
- }
- }*/
- //142. Треугольник задан координатами своих вершин. Составить программу вычисления его площади.
- // Nechto inoe, potok vvoda, test
- /*import java.util.*;
- public class Main{
- public static void main (String [] args){
- Scanner reader = new Scanner(System.in);
- System.out.println("Vvedite svoe pervoe soobshenie");
- String a;
- a = reader.nextLine();
- System.out.println(a);
- }
- }*/
- /*class Main {
- public static void main(String[] args) {
- java.util.ArrayList<Integer> mas = new java.util.ArrayList<Integer>();
- mas.add(5);
- mas.add(10);
- mas.add(15);
- for (int i = 0; i < mas.size (); i++) {
- System.out.print(mas.get(i) + " ");
- }
- }
- }*/
- // Вычисление выражения стр 18 № 5 Ускова
- /*import java.util.Scanner;
- public class Main{
- public static int x;
- public static void main (String [] args){
- FirstEqual a = new FirstEqual();
- SecondEqual b = new SecondEqual();
- Scanner reader = new Scanner(System.in);
- System.out.print("Введите х: ");
- x = reader.nextInt();
- if ((x*x) - x <= 1){
- System.out.print(a.Equal(x));
- }
- else if ((x*x) - x > 1){
- System.out.print(b.Equal(x));
- }
- else {
- System.out.println("Error");
- }
- }
- }
- class FirstEqual{
- public int Equal (int x){
- return x*x*x - 3*x + 8;
- }
- }
- class SecondEqual{
- public double Equal (int x){
- return 1/(x*x*x - 3*x + 8);
- }
- }*/
- // По заданным значениям вычислить значения u стр 18 пункт b)
- /*import java.util.Scanner;
- public class Main{
- public static int x,y,a,b,c,d;
- public static void main (String [] args){
- Scanner reader = new Scanner(System.in);
- System.out.print("Введите a,b,c,d для определения интервалов/отрезков: ");
- a = reader.nextInt();
- b = reader.nextInt();
- c = reader.nextInt();
- d = reader.nextInt();
- FirstEqual a1 = new FirstEqual();
- SecondEqual a2 = new SecondEqual();
- ThirdEqual a3 = new ThirdEqual();
- System.out.print("Введите числа x , y: ");
- x = reader.nextInt();
- y = reader.nextInt();
- if (((a*x + b*y) >= c) && ((a*x + b*y) < d)){
- System.out.print(a1.Equal(x,y,a,b));
- }
- else if ((a*x + b*y) < c){
- System.out.print(a2.Equal(x,y));
- }
- else if ((a*x + b*y) >= d){
- System.out.print(a3.Equal(x,y));
- }
- else {
- System.out.println("ERROR");
- }
- }
- }
- class FirstEqual{
- public int Equal(int x, int a, int y, int b){
- return a*x + b*y;
- }
- }
- class SecondEqual{
- public int Equal (int t, int q){
- return t + q;
- }
- }
- class ThirdEqual{
- public int Equal (int a, int b){
- return 1 - a - b;
- }
- }*/
Advertisement
Add Comment
Please, Sign In to add comment