Skip to content
GitLab
Explore
Sign in
Primary navigation
Search or go to…
Project
J
Java1
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Model registry
Operate
Environments
Monitor
Incidents
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
Community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
Matthias Hoffmann
Java1
Commits
a79a269d
Commit
a79a269d
authored
5 years ago
by
mh16842
Browse files
Options
Downloads
Patches
Plain Diff
added Pasch
parent
92577f3a
No related branches found
No related tags found
No related merge requests found
Changes
1
Hide whitespace changes
Inline
Side-by-side
Showing
1 changed file
Übungsblatt 5/src/pasch/Pasch.java
+31
-0
31 additions, 0 deletions
Übungsblatt 5/src/pasch/Pasch.java
with
31 additions
and
0 deletions
Übungsblatt 5/src/pasch/Pasch.java
0 → 100644
+
31
−
0
View file @
a79a269d
package
pasch
;
import
java.util.Random
;
public
class
Pasch
{
public
static
void
main
(
String
[]
args
)
{
int
wuerfel1
;
int
wuerfel2
;
int
wuerfel3
;
int
anzahlWuerfe
=
0
;
while
(
true
)
{
wuerfel1
=
new
Random
().
nextInt
(
6
)
+
1
;
wuerfel2
=
new
Random
().
nextInt
(
6
)
+
1
;
wuerfel3
=
new
Random
().
nextInt
(
6
)
+
1
;
anzahlWuerfe
++;
System
.
out
.
println
(
"Wurf, "
+
anzahlWuerfe
+
" Gewuerfelt, "
+
wuerfel1
+
", "
+
wuerfel2
+
", "
+
wuerfel3
);
if
(
wuerfel1
==
wuerfel2
&&
wuerfel1
==
wuerfel3
)
{
break
;
}
}
System
.
out
.
println
(
"Pasch!"
);
}
}
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment