my program has the following errors:

there are primary-expressions expected before "else"

the upon commening on the lines with else, i got a mistake like "core dumped" and it couldn't run no more. could anyone please take a minute to go through my programm and kindly let me know where the errors are, if possible suggest on what i should do or correct my code please.

```
#include<iostream>
#include<cmath>
#include<cstdlib> //memory management
using namespace std;
int main(){
int arr[50];
int zahl;
int sum = 0;
int average;
int j;
int median;
double sum2 = 0;
double deviation;
double sqrdeviation;
double msqrdeviation;
double standarddeviation;
cout<<"please key integers not exeeding 50 and not a zero: ";
cin>> zahl;
int i;
for(i = 1;zahl!=0;i++){ // i is the actual count of given numbers i.e normally frm 1
arr = zahl; //storage of given number
}
for(int k=0;k < i;k++){ // k is the storage of numbers in array i,e k is the index in array
sum = sum + arr[k]; //sum = to sum + the number stored at index 0 and the k++ helps move nxt position
average = sum/i; // divide by i the actual count
cout<<"The avearge/mittelwert = "<<average;
deviation=arr[k] - average;//calculating the deviation 4rm mean
sqrdeviation = (pow(deviation, 2));//squaring the deviation from mean
sum2 += sqrdeviation;//adding the square from deviation from mean
k++;// moving to the next level
msqrdeviation = sum2/i;// getting mean of squared deviations
standarddeviation = sqrt(msqrdeviation);
if(standarddeviation>0){
cout<<"standardeviation: "<<standarddeviation<<endl;
else
cout<<"standarddeveiation not valid.";
}
}
j=i/2;//calculating the median
if (i%2!=0){
median = arr[j];
cout<<"median is: "<<median<<endl;
else
median = (arr[j]+ arr[j-1])/2; // for even numbers
cout<<"median is: "<<median;
}
return 0;
}
```