Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- package com.company;
- public class Main {
- public Main() {
- }
- public static void main(String[] args) {
- int N_MIN = true;
- int N_MAX = true;
- int N = true;
- boolean kopie = false;
- short geloescht = 0;
- short[] ganzzahlen = new short[100];
- short[] geordnet = new short[100];
- int x;
- int k;
- for(x = 0; x < 100; ++x) {
- ganzzahlen[x] = (short)((int)(Math.random() * 100.0D + 1.0D));
- for(k = 0; k < x; ++k) {
- if (ganzzahlen[x] == ganzzahlen[k]) {
- kopie = true;
- break;
- }
- }
- if (!kopie) {
- geordnet[x] = ganzzahlen[x];
- } else {
- ++geloescht;
- }
- System.out.println(ganzzahlen[x] + " " + geordnet[x]);
- kopie = false;
- }
- System.out.println();
- for(x = 0; x < 100; ++x) {
- k = 0;
- while(geordnet[x] == 0) {
- for(int y = x; y < 99; ++y) {
- geordnet[y] = geordnet[y + 1];
- k += geordnet[y];
- }
- if (k == 0) {
- break;
- }
- }
- }
- System.out.println();
- short[] gekuerzt = new short[100 - geloescht];
- for(k = 0; k < 100 - geloescht; ++k) {
- gekuerzt[k] = geordnet[k];
- System.out.println(gekuerzt[k]);
- }
- }
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement