mirror of
https://github.com/13hannes11/archive.git
synced 2024-09-03 21:50:58 +02:00
added all past projects
This commit is contained in:
19
Java/IF/IF_01/src/if_01/IF_01.java
Normal file
19
Java/IF/IF_01/src/if_01/IF_01.java
Normal file
@@ -0,0 +1,19 @@
|
||||
package if_01;
|
||||
import java.util.*;
|
||||
public class IF_01 {
|
||||
public static void main(String[] args) {
|
||||
Random generator = new Random();
|
||||
|
||||
int zahl1 = generator.nextInt();
|
||||
double ergebnis = 0;
|
||||
if(zahl1 > 0)
|
||||
{
|
||||
ergebnis = Math.sqrt(zahl1);
|
||||
System.out.println("Wurzel aus " + zahl1 + " ergibt " + ergebnis);
|
||||
}
|
||||
else
|
||||
{
|
||||
System.out.println("Aus diser Zahl (" +zahl1+ ") kann keine Wurzel aus einer Zahl kleiner 0 ziehen.");
|
||||
}
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user