kiem tien, kiem tien online, kiem tien truc tuyen, kiem tien tren mang
Thursday, October 2, 2014

viết chương trình c tìm phần tử nhỏ nhất "min" và phần tử lớn nhất có trong mảng "max", in ra màn hình các giá trị đó

#include<stdio.h>
#include<conio.h>
int a[100];
void main()
{
int i, n, max, min;
printf("nhap so phan tu cua mang: ");
scanf_s("%d", &n);
for (i = 0; i < n; i++)
{
printf("nhap phan tu thu %d: ", i + 1);
scanf_s("%d", &a[i]);
}
max = a[0]; min = a[0];
for (i = 1; i < n; i++)
{
if (min > a[i])min = a[i];
if (max < a[i])max = a[i];
}
printf("phan tu nho nhat la: %d\n", min);
printf("phan tu lon nhat la: %d\n", max);
_getch();
}

02 Oct 2014

0 comments:

Post a Comment

:) :)) ;(( :-) =)) ;( ;-( :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

Popular Posts