Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <stdio.h>
- #include <stdlib.h>
- #include <time.h>
- int main(void){
- int zzufall = 0;
- int zeing = 0;
- int versuche = 0;
- //Zufallszahl generieren
- srand(time());
- zzufall = (rand()%100) + 1;
- while(zeing != zzufall)
- {
- printf("Eingabe einer möglichen Zahl: ");
- //Eingabe der geratenen Zahl
- scanf("%i",&zeing);
- //Zahl zu groß / klein
- if(zeing < zzufall)
- {
- printf("Zahl zu klein\n");
- }
- else if(zeing > zzufall)
- {
- printf("Zahl zu groß\n");
- }
- versuche++;
- }
- printf("richtig - %i Versuche", versuche);
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement