Mein Programm soll die Summe der Zahlen berechnen und zusammen mit dem Mittelwert beim Programmende ausgegeben werden. Funktioniert aber nicht !!!
Ich bitte um Hilfe !!!
#include "pch.h"
#include <iostream>
#include <stdio.h>
#include <ctype.h>
int main()
{
int x, anzahl;
double zahl, summe = 0.0, mittelw;
printf("\n\t Statistik\n");
printf("\nWieviel Werte wollen Sie eingeben: ");
scanf_s("%i", &anzahl);
printf("\n");
for (x = 1; x <= anzahl; x = x + 1)
{
printf("Bitte %i. Zahl eingeben: ", x);
scanf_s("%1.f", &zahl);
summe = summe + zahl;
}
mittelw = summe / anzahl;
printf("\n\nSumme der Zahlen = %f", summe);
printf("\nMittelwert der Zahlen = %f", mittelw);
}
Dankeschön !!!