6

You might also like

Download as docx, pdf, or txt
Download as docx, pdf, or txt
You are on page 1of 3

#include <stdio.

h>
#include <math.h>

int main(){
int x[20];
int n;
int a;
int b;
int i;
int j;
scanf("%d",&a);
scanf("%d",&b);
long int temp = 0;
for(int i = 0; i<n; i++)
temp+=x[i];

scanf("%d",n);
do{
for( i = 0; i < n; i++){
printf("\nNhap x[%d] = ",i);
scanf("%d", &x[i]);

if(a<=x[i] && x[i]>b){


printf("\nNhap lai xi");
}
}while(temp>a*b);
//cau b
for( i = 0; i < n; i++){
printf("\nNhap a[%d] = ",i);
scanf("%d", &x[i]);
}

int tg;
for( i = 0; i < n - 1; i++){
for( j = i + 1; j < n; j++){
if(x[i] > x[j]){

tg = x[i];
x[i] = x[j];
x[j] = tg;
}
}
}

printf("\nMang da sap xep la: ");


for( i = 0; i < n; i++){
printf("%5d", x[i]);
}

int sum = 0;
for ( i = 0; i < n; i++)
{
if (x[i] % 2 != 0)
{
continue;
}
sum += x[i];
}
printf("tong so le la:%d",sum);
}

You might also like