Skip to content

Create L1 Exersicises #5

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

Conversation

Ruslan2322
Copy link

Hi, please check me!, BR

Hi, please check me!,   BR
Comment on lines +1 to +460

// Даны числовой ряд и некоторое число е. Найти сумму тех членов ряда, модуль которых больше или равен
// заданному е. Общий член ряда имеет вид: a = 1/2^n + 1/3^n;

System.out.println("Input е");
Scanner scanner = new Scanner(System.in);
double e = scanner.nextDouble();

int n = 0;
double sum = 0;
System.out.println("Print a series of common member series: ");
for (int i = 0; i<=10; i++){
++n;
System.out.print("\n");
double a = (1/Math.pow(2,n))+ (1/Math.pow(3,n));
System.out.printf("%.4f", a);
if (e <= Math.abs(a))
sum = sum+a;
System.out.printf(" sum is %f", sum);
}
}
}

EXERCISE 6

public class TestMain {
public static void main(String... asf)
{

for(int i =0; i<256; i++)
{
System.out.println( i + ". " + (char)i);
}
}
}


EXERCISE 7

import java.util.Scanner;

public class TestMain {
public static void main(String[] args) {

// rus: Для каждого натурального числа в промежутке от m до n вывести все делители, кроме единицы и самого числа.
// m и n вводятся с клавиатуры.

// eng: For each positive integer in the range from m to n, print all dividers except for the unit and the number itself.
// m and n are entered from the keyboard.

Scanner scanner = new Scanner(System.in);
System.out.println("Enter start of line numbers m ");
int m = scanner.nextInt();
System.out.println("Enter end of line numbers n ");
int n = scanner.nextInt();

while (m <= n) {
System.out.print("\n number: " + m);
System.out.print(" its dividers: ");
for (int i = 2; i <= m - 1; i++) {
if (m % i == 0) {
System.out.print(i + ",");
}
}
m = m + 1;
}
}
}

EXERCISE 8

public class TestMain {
public static void main(String[] args) {
// Создаём массив и вводим руками ао 1 числу в каждый элемент массива
int[] number1 = {1, 3, 4};
int[] number2 = {2, 3, 4};
for (int v : number1)
System.out.print(v);
System.out.print(" ");
for (int v1 : number2)
System.out.print(v1);
{
int[] number3 = new int[number1.length];
int count = 0;

for (int i = 0; i < number1.length;i++) {
if (number1[i] == number2[i]) {
number3[count] = number1[i];
count++;
System.out.println(" ");
for (int v2 : number3)
System.out.print(v2);

}
}
}
}
}


Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Good!!!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

2 participants