Zum Inhalt springen
View in the app

A better way to browse. Learn more.

Fachinformatiker.de

A full-screen app on your home screen with push notifications, badges and more.

To install this app on iOS and iPadOS
  1. Tap the Share icon in Safari
  2. Scroll the menu and tap Add to Home Screen.
  3. Tap Add in the top-right corner.
To install this app on Android
  1. Tap the 3-dot menu (⋮) in the top-right corner of the browser.
  2. Tap Add to Home screen or Install app.
  3. Confirm by tapping Install.

Paarthurnax

User
  • Registriert

  • Letzter Besuch

Reputationsaktivität

  1. verwirrt
    Paarthurnax hat auf elgorgo in Aufgabe in C für Studium   
    Ja, selbstverständlich.
    Ich zetere da weiter!
     
  2. verwirrt
    Paarthurnax hat auf Maniska in Aufgabe in C für Studium   
    Dein Ansatz wäre?
    Also einfach mal in Worten, ohne Code:
    WENN x durch 2 teilbar ist, DANN soll x/2 als Ergebnis ausgegeben werden SONST soll ein Fehler mit printf ausgegeben werden Und jetzt bitte etwas erkennbare Eigenleistung.
  3. Danke
    Paarthurnax hat auf Tiwil in Aufgabe in C für Studium   
    @Paarthurnax
    Wie geschrieben, modulo heißt das Zauberwort. Geschrieben bspw.: x%2 (gesprochen x modulo 2)
  4. Positiv
    Paarthurnax hat eine Reaktion von Tiwil in Aufgabe in C für Studium   
    Okay also zusammenfassend ist das dann die Lösung(Für alle mit demselben Problem):
     
    #include <stdio.h>
     
    int main () {
     
    //Variablen
        int x;
     
    //Eingabe
        printf("Bitte gib die Zahl ein die durch 2 geteilt werden soll.\n");
        scanf("%d", &x);
     
    //Ausgabe
        if (x%2==0)
        {
            int a = x/2;
            printf("Das Ergebnis lautet %d", a);
     
        } else {
            printf("Fehler");
        }
       
        return 0;
    }


    Hier "if (x%2==0)"  wird dann einfach nur abgefragt ob x einen Rest besitzt oder nicht. Falls nein wird x/2 gerechnet, falls ja wird der Fehler ausgegeben.

Configure browser push notifications

Chrome (Android)
  1. Tap the lock icon next to the address bar.
  2. Tap Permissions → Notifications.
  3. Adjust your preference.
Chrome (Desktop)
  1. Click the padlock icon in the address bar.
  2. Select Site settings.
  3. Find Notifications and adjust your preference.