Advertisement
Guest User

if-else

a guest
Nov 25th, 2017
63
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.50 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. /* run this program using the console pauser or add your own getch, system("pause") or input loop */
  5.  
  6. int main(int argc, char *argv[]) {
  7.     int eingabe;
  8.     printf ("1, 2 oder 3: ");
  9.     scanf("%d", &eingabe);
  10.    
  11.     if (eingabe == 1) {
  12.         printf("1 wurde gedrueckt");
  13.     }
  14.     else if (eingabe == 2) {
  15.         printf("2 wurde gedrueckt");
  16.     }
  17.     else if (eingabe == 3) {
  18.         printf("3 wurde gedrueckt");
  19.     }
  20.     else {
  21.         printf("Irgendwas wurde gedrueckt");
  22.     }
  23.    
  24.  
  25.     return 0;
  26. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement