FindSlide.org - это сайт презентаций, докладов, шаблонов в формате PowerPoint.
Email: Нажмите что бы посмотреть
Array
Array
Array
double m[4][4]; // Error;
What will be displayed?
int number = 0;
while (number <= 5) {
System.out.println(number);
number++;
}
do {
statements;
} while (condition);
What will be displayed?
int i = 0;
do {
System.out.print(++i);
} while (i < 5);
for (init; condition ; increment) {
statement(s);
}
Another representation of statement for
int product = 1;
for (int i = 0; i < 5; i++) {
if (arr[i] > 0) {product = product * arr[i];}}
System.out.println("Product = " + product);
int amount = 0;
for (int a : arr) {
if (a > 0 && a <= 7) { amount++; }
}
System.out.println("Amount = " + amount);
int sum = 0;
for (int i = 0; i < arr.length; i++) { sum += arr[i];}
System.out.println("Sum = " + sum);
int max = arr[0];
int imax = 0;
int i = 0;
while (i < arr.length) {
if (arr[i] > max) {
max = arr[i];
imax = i;
}
i++;
}
System.out.print("Maximum = " + max);
System.out.println(" is in " + (imax + 1) + " place");
Practical tasks
Homework