-
Notifications
You must be signed in to change notification settings - Fork 183
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
Ruslan2322
wants to merge
1
commit into
Java0Tutor:master
Choose a base branch
from
Ruslan2322:patch-1
base: master
Could not load branches
Branch not found: {{ refName }}
Loading
Could not load tags
Nothing to show
Loading
Are you sure you want to change the base?
Some commits from the old base branch may be removed from the timeline,
and old review comments may become outdated.
Open
+460
−0
Conversation
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Hi, please check me!, BR
Ludmilaunia
reviewed
Sep 7, 2020
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); | ||
|
||
} | ||
} | ||
} | ||
} | ||
} | ||
|
||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Good!!!
Ludmilaunia
approved these changes
Sep 7, 2020
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
Hi, please check me!, BR