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.

HILFE If-schleife

Empfohlene Antworten

Hi Leutz hab ein gróßes Prob: Ich soll eine ifschleife programmieren wo man die Zahl eingibt und das programm die Stellen (1 stellig,2 stellig usw.) angibt) soll bis 4 stellig gemacht werden und über 4stellig da stehen hat mehr als 4 stellen

import java.io.*;

public class ifschleife

{

public static void main(String[] args)

{

int var1;

InputStreamReader daten;

daten= new InputStreamReader(System.in);

BufferedReader ausgabe;

ausgabe= new BufferedReader(daten);

try

{

System.print.out(" eingeben bitte");

var1 = Integer.parseInt(ausgabe.readLine());

{

if var1 >9999;

{

System.out.println("Die Zahl "+var1+" ist 5 stellig oder mehr");

}

else var1 > 999;

{

System.out.println("Die Zahl "+var1+" ist 4 stellig");

}

else if var1 > 99;

{

System.out.println("Die Zahl "+var1+" ist 3 stellig");

}

else if var1 > 9;

{

System.out.println("Die Zahl "+var1+" ist 2 Stellig");

}

else if var1 < 10 ;

{

System.out.println("Die Zahl "+var1+" ist 1 Stellig");

}

} catch (Exception e)

{

System.out.println("Falsche Eingabe");

}

}

}

Gruß Mo

import java.io.*;

public class ifschleife

{

public static void main(String[] args)

{

int var1; var1 = 1;

InputStreamReader daten;

daten= new InputStreamReader(System.in);

BufferedReader ausgabe;

ausgabe= new BufferedReader(daten);

try

{

System.out.print(" eingeben bitte: ");

var1 = Integer.parseInt(ausgabe.readLine());

} catch (Exception e)

{

if ( var1 >9999 )

System.out.println("Die Zahl "+var1+" ist 5 stellig oder mehr");

else if (var1 > 999 )

System.out.println("Die Zahl "+var1+" ist 4 stellig");

else if ( var1 > 99 )

System.out.println("Die Zahl "+var1+" ist 3 stellig");

else if ( var1 > 9 )

System.out.println("Die Zahl "+var1+" ist 2 Stellig");

else if ( var1 < 10 )

System.out.println("Die Zahl "+var1+" ist 1 Stellig");

{

System.out.println("Falsche Eingabe");

}

}

}

}

Soweit hab ichs hingekriegt, funktioniert auch zu kompelieren aber er will nicht das entsprechene ausspucken

*g* hat sich schon erledigt pumuckel16 hat sich per icq bei mir gemeldet und mir geholfen, trotzdem thx

Archiv

Dieses Thema wurde archiviert und kann nicht mehr beantwortet werden.

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.