SHARE
TWEET

Notendurchschnitt

GhostTV Dec 3rd, 2019 71 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. #include <stdio.h>
  2.  
  3. int main(void){
  4.     float Summe = 0;
  5.     int Anzahl = 0;
  6.     float Note;
  7.     float Durchschnitt;
  8.    
  9.     scanf("%f",&Note);
  10.    
  11.     while(Note != 0)
  12.     {
  13.        
  14.         if(Note > 0 && Note <=6)
  15.         {
  16.             Summe = Summe + Note;
  17.             Anzahl++;
  18.         }
  19.         else
  20.         {
  21.             printf("Nur Ziffern von 1-6!");
  22.         }
  23.        
  24.         scanf("%f",&Note);
  25.  
  26.     }
  27.    
  28.     if(Anzahl >= 2)
  29.     {
  30.         Durchschnitt = Summe / Anzahl;
  31.         printf("%.2f",Durchschnitt);
  32.     }
  33.     else
  34.     {
  35.         printf("Zu wenige Noteneingaben");
  36.     }
  37.    
  38.     return 0;
  39. }
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top