Advertisement
Guest User

Untitled

a guest
Jul 21st, 2017
48
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C 0.65 KB | None | 0 0
  1. #include <stdio.h>
  2. #include <stdlib.h>
  3.  
  4. int main(void)
  5. {
  6.     char name[20+1];
  7.     int note[4];
  8.     double schnitt;
  9.    
  10.     printf("Bitte Name eingeben:\n");
  11.     scanf("%s", name); fflush(stdin);
  12.    
  13.     int i;
  14.     for(i=0;i<3;i++)
  15.     {
  16.                     printf("Bitte Note eingeben:\n");
  17.                     scanf("%d", note[i]); fflush(stdin);
  18.     }
  19.    
  20.     schnitt=0.0;
  21.     system("pause");
  22.     for(i=0; i<3;i++)
  23.     {
  24.              schnitt = schnitt + (double)note[i];
  25.     }
  26.     system("pause");
  27.    
  28.     schnitt = schnitt / 4.0;
  29.    
  30.     printf("%s hat einen Schnitt von %lf\n",name, schnitt);
  31.    
  32.     system("pause");
  33.    }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement