Skip to content

test #10

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 1 commit into
base: master
Choose a base branch
from
Open

test #10

Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
44 changes: 44 additions & 0 deletions Lesson_01_Practice/Practise
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package Lesson_01;
import java.util.Scanner;

//Найдите значение функции: z = ( (a – 3 ) * b / 2) + c.

public class Ex_1 {
public static void main(String[] args) {
Scanner s = new Scanner(System.in);
System.out.println("Введите значение а: ");
int a = s.nextInt();
System.out.println("Введите значение b: ");
int b = s.nextInt();
System.out.println("Введите значение c: ");
int c = s.nextInt();
double z = (((a-3)*b/2)+c);
System.out.println(z);
}
}


package Lesson_01;

//Вычислить значение выражения по формуле (все переменные принимают действительные значения):
//(b + sqrt(b^2 + 4*a*c))/2 - a^3*c +(1/b^2)

public class Ex_2 {
public static void main(String... asf) {
// Объявим переменные для степеней переменных
int v1 = 2;
int v2 = 3;
int v3 = -2;
double z;
// Объявим значения переменных с = 1.0 , b = 2.0, a = 3.0
double c = 5.0;
double a = 2.0, a1 = Math.pow(a, v2);
double b = 1.0, b1 = Math.pow(b, v1), b2 = Math.pow(b, v3);
double t = Math.sqrt(Math.pow(b, a1) + 4 * a * c);
double t1 = (b + t) % 2 * a;
z = t1 - a1 * c + b2;

System.out.println(z);

}
}