Untitled

mail@pastecode.io avatar
unknown
plain_text
2 months ago
819 B
3
Indexable
Never
#include<iostream>
#include<numeric>
using namespace std;
int main (){
	int n;
	double s = 0;
	cout << "vui long nhap  gia tri n :(n <= 200)";
	cin >> n;
    int a[n];
	for(int i = 0; i < n ; i++){
		cin >> a[i] ;
		s =  s + a[i];
	}
	int index = 0 , value;
	cin >> value ;
	int b[n + 1];
	for ( int i = 0 ;i< n + 1 ; i++)
	{
		if( i == 0 ){
			b[i]=value;
		}else {
			b[i] = a[i - 1] ;
			
		}
	cout << b[i]<< " ";
	
	}
	cout << endl;
	int max = b[n];
	for (int i = n; i = 0 ;i--){
		if ( max <= b[i])
		{
			max = b[i];
		}
	}

	cout <<"Max la : " << max<< endl;
	int min = b[0];
	for ( int i = 0; i < n+1 ; i++){
		if ( min >= b[i])
		{
			min = b[i];
	
		}
	} 
	double tb = s / n;
	cout <<"Min la :"<< min<< endl;
	cout<< "Medium score la :" << tb;
			return 0;
}
Leave a Comment