kiem tien, kiem tien online, kiem tien truc tuyen, kiem tien tren mang
Chủ Nhật, 1 tháng 6, 2014

#include <iostream>
#define MAX 100
using namespace std;
void nhapMang(int a[],int &n){
    cout<<"Mang co bao nhieu phan tu? ";
    cin>>n;
    for(int i=0;i<n;i++){
        cout<<"a["<<i<<"]= ";
        cin >>a[i];
    }
}
void inMang (int a[],int n){
    for (int i=0;i<n;i++){
        cout<<a[i]<<"   ";
    }
}
void inMang2 (int a[], int i, int j){
    for(int k = i-1;k<j;k++)
        cout<<a[k]<<"  ";
}
void tongHieuMang(int a[],int b[],int n){
    for(int i=0;i<n;i++){
        cout<<a[i]+b[i]<<" ";
    }
    cout<<"\n";
    for(int i=0;i<n;i++){
        cout<<a[i]-b[i]<<" ";
    }

}


void chiaHetK(int a[],int n,int k){
    for(int i=0;i<n;i++){
        if (a[i]%k==0){
            cout<<a[i]<<"  ";
        }
    }
}

int tongChan(int a[],int n){
    int sum = 0;
    for(int i=0;i<n;i++){
        if (a[i]%2==0){
            sum = sum + a[i];
        }
    }
    return sum;
}

float trungBinh(int a[],int n){
    int sum = 0;
    for(int i=0;i<n;i++){
        sum = sum + a[i];
    }
    return 1.0 * sum / n ;
}
int main(){
    int a[MAX];
    int n=0;
    nhapMang(a,n);
    inMang(a,n);
    return 0;
}
01 Jun 2014

0 nhận xét:

Đăng nhận xét

:) :)) ;(( :-) =)) ;( ;-( :d :-d @-) :p :o :>) (o) [-( :-? (p) :-s (m) 8-) :-t :-b b-( :-# =p~ $-) (b) (f) x-) (k) (h) (c) cheer
Click to see the code!
To insert emoticon you must added at least one space before the code.

domain, domain name, premium domain name for sales

Bài đăng phổ biến