average_calculator_musa

mail@pastecode.io avatar
unknown
c_cpp
2 years ago
736 B
5
Indexable
Never

#include <iostream>

using namespace std;

int main()
{
    const int UZUNLUK=10;
    double arr[UZUNLUK];
    double min,max;
    double toplam=0;
    double maxminOrt,ort;
		for(int i=0;i<10;i++) {
		    cout<<i<<". index icin deger girin";
		    cin>>arr[i];
		  
		}
		min=max=arr[0];
		for(int j=0;j<10;j++){
            if(arr[j] > max)
                max = arr[j];
            if(arr[j] < min)
                min = arr[j];
            toplam+=arr[j];
		}
		cout<<"max"<<max<<endl;
		cout<<"min"<<min<<endl;
		ort=toplam/(double)UZUNLUK;
		cout<<"array elemanlarinin ortalamasi"<<ort<<endl;
	
		maxminOrt=(max+min)/2;
		cout<<"max min ortalamasi"<<maxminOrt<<endl;
		cout<<"Ortalama= "<<(ort+maxminOrt)/2<<endl;
    return 0;
}