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.

Programm

Empfohlene Antworten

Veröffentlicht

Hi Leute!

Ha da mal ein kleines Problem!Versuche schon seit einer halben Stunde ein c-programm zu schreiben das die Zahlen von 1-10,9-1,10-1,9-1 hintereinader schreibt!Das soll dann so aussehen:123456789109876543212345678910987654321

Hab zwar schon einen Taschenrechner und andere Programme geschrieben aber das fällt mir bis jetzt am schwersten!

Achtung: Nicht nur einfach die Zahlen mit printf ausgeben!

Das Programm darf nur 1 for und eine If-Schleifen enthalten!

Wenn ich mehrere For-Schleifen machen dürfte, wäre es kein Problem!

Danke ;)

Zählt "if..then..else" als eins?

MVG

need-some-blood

bin der stiften-kollege von red cap und ich denke das würde auch zählen

So. Ich habs. eigentlich ganz einfach. Hier mal mein Pseudocode


pout(1)

for 1:=0 to 35 {

  i:=(i mod 9)+2

  if ((i div 9)mod 2)==1) i:=9-(i mod 9)

  pout (i)

}

Code wurde nicht getestet.

MVG

need-some-blood

Hab mal hier meinen Quelltext vielleicht kannst du mir ja sagen, was daran falsch ist und ihn verbessern!

#include <stdio.h>

void main (void)

{

int i=0;

for(i=0;i<=40;i++)

{

int lauf = i/10;

int rest = lauf%2;

int ausgabe=0;

if(rest==0)

{

ausgabe=i-(lauf*10);

}

else

{

ausgabe=10 - (i-(lauf*10));

}

printf ("%i,",ausgabe);

}

getchar ();

return 0;

}

Das Programm gibt es so aus:

1234567891098765432,10,123456789109876543210

- >Die eins und null ist zu viel!

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.