Prak Tag 1
This commit is contained in:
@@ -0,0 +1,17 @@
|
||||
// Press Shift twice to open the Search Everywhere dialog and type `show whitespaces`,
|
||||
// then press Enter. You can now see whitespace characters in your code.
|
||||
public class Main {
|
||||
public static void main(String[] args) {
|
||||
// Press Alt+Eingabe with your caret at the highlighted text to see how
|
||||
// IntelliJ IDEA suggests fixing it.
|
||||
System.out.printf("Hello and welcome!");
|
||||
|
||||
// Press Umschalt+F10 or click the green arrow button in the gutter to run the code.
|
||||
for (int i = 1; i <= 5; i++) {
|
||||
|
||||
// Press Umschalt+F9 to start debugging your code. We have set one breakpoint
|
||||
// for you, but you can always add more by pressing Strg+F8.
|
||||
System.out.println("i = " + i);
|
||||
}
|
||||
}
|
||||
}
|
||||
@@ -0,0 +1,32 @@
|
||||
package Prak1;
|
||||
|
||||
public class Zahlenfilter {
|
||||
|
||||
public static void main(String[] args){
|
||||
filter();
|
||||
}
|
||||
|
||||
public static void filter(){
|
||||
int i;
|
||||
int x;
|
||||
for( i = 0; i <= 200; i++) {
|
||||
if( i % 5 == 0 ){
|
||||
System.out.println( i + " ist durch 5 teilbar");
|
||||
} else{
|
||||
if(i % 10 == 9){
|
||||
System.out.println( i + " endet auf 9");
|
||||
} else{
|
||||
x = i + (i-1);
|
||||
if( x % 3 == 0){
|
||||
System.out.println(i + " und " + (i-1) + " addiert ergeben "+ x + " und " + x + " ist durch 3 teilbar");
|
||||
} else{
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
@@ -0,0 +1,26 @@
|
||||
package Prak1;
|
||||
|
||||
public class Zahlenfilter_save {
|
||||
|
||||
public static void main(String[] args){
|
||||
int i;
|
||||
int x;
|
||||
for( i = 0; i <= 200; i++) {
|
||||
if( i % 5 == 0 ){
|
||||
System.out.println( i + " ist durch 5 teilbar");
|
||||
} else{
|
||||
if(i % 10 == 9){
|
||||
System.out.println( i + " endet auf 9");
|
||||
} else{
|
||||
x = i + (i-1);
|
||||
if( x % 3 == 0){
|
||||
System.out.println(i + " und " + (i-1) + " addiert ergeben "+ x + " und " + x + " ist durch 3 teilbar");
|
||||
} else{
|
||||
System.out.println(i);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user