Skip to content

Instantly share code, notes, and snippets.

@H4kor
Created October 28, 2010 06:58
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save H4kor/650802 to your computer and use it in GitHub Desktop.
Save H4kor/650802 to your computer and use it in GitHub Desktop.
Progra Übung1
public class Programm{
public static void main(String[] params){ //int N Parameter entfernt, [] zu Strings hinzugefügt
int n;
System.out.println("Dieses Programm berechnet die Anzahl des Klingelns beim Sektempfang"); // Ausdruck in eine Zeile geschrieben
System.out.println("D.h. dieses Programm berechnet n*(n-1)/2, gegeben n");
System.out.print("Geben Sie die Zahl der Besucher ein: ");
//Wartet auf Eingabe einer Zahl druch den Benutzer und speichert sie in n
n = IO.readInt(); //N zu n geamcht
int x = (n*(n-1))/2; //richtige Berechnung eingesetztz
System.out.println("Das Ergebnis ist: " + x);
//System.out.println( + n); //schreibt die eingegebene Zahl in eine neue Zeile
}
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment