This is default featured slide 1 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 2 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 3 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 4 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

This is default featured slide 5 title

Go to Blogger edit html and find these sentences.Now replace these sentences with your own descriptions.

Hiển thị các bài đăng có nhãn tin hoc. Hiển thị tất cả bài đăng
Hiển thị các bài đăng có nhãn tin hoc. Hiển thị tất cả bài đăng

bai toan


#include
#include
#include
void main()
{
float S;
int a[100], b[100];
int i,n,d,t,maxx,maxy;
printf("Nhap n:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("M%d(a[%d];b[%d])",i,i,i);
scanf("%d%d",&a[i],&b[i]);
}
/*Tinh do dai duong gap khuc */
S=sqrt((a[n]-a[1])*(a[n]-a[1])+(b[n]-b[1])*(b[n]-b[1]));
for(i-2;i<=n;i++)
S=S+sqrt((a[n]-a[1])*(a[n]-a[1])+(b[n]-b[1])*(b[n]-b[1]));
printf("Do dai duong gap khuc=%f",S);
/*Dem so diem thuoc goc phan tu thu nhat va thu tu */
d=0; t-0;
for(i=1;i<=n;i++)
{
if(a[i]>0&&b[i]>0)
d++;
if(a[i]>0&&b[i]<0)
t++;
}
printf("So diem thuoc goc phan tu thu nhat =%d",d);
printf("So diem thuoc goc phan tu thu tu =%d",t);
/*Tim hinh chu nhat co cac canh song song voi truc toa do chua n diem tren */
maxx=abs a[i];
maxy=abs b[i];
for(i=2;i<=n;i++)
{
if(maxx
maxx=abs a[i];
if(maxy
maxy=abs b[i];
}
printf("Hinh chu nhat co cac canh song song voi truc toa do la :%




CAch 2
#include
#include
#include
void main()
{
double S,dmax,e,s;
int a[100], b[100];
int i,n,d,t,maxx,maxy;
printf("Nhap n:");
scanf("%d",&n);
for(i=1;i<=n;i++)
{
printf("M%d(a[%d];b[%d])",i,i,i);
scanf("%d%d",&a[i],&b[i]);
}
/*Tinh do dai duong gap khuc */
S=sqrt((a[n]-a[1])*(a[n]-a[1])+(b[n]-b[1])*(b[n]-b[1]));
for(i=2;i<=n;i++)
S=S+sqrt((a[n]-a[1])*(a[n]-a[1])+(b[n]-b[1])*(b[n]-b[1]));
printf("\nDo dai duong gap khuc=%f",S);
/*Dem so diem thuoc goc phan tu thu nhat va thu tu */
d=0; t=0;
for(i=1;i<=n;i++)
{
if(a[i]>0&&b[i]>0)
d++;
if(a[i]>0&&b[i]<0)
t++;
}
printf("\nSo diem thuoc goc phan tu thu nhat =%d",d);
printf("\nSo diem thuoc goc phan tu thu tu =%d",t);
/*Tim hinh chu nhat co cac canh song song voi truc toa do chua n diem tren */
maxx=abs (a[1]);
maxy=abs (b[1]);
for(i=1;i<=n;i++)
{
if(maxx
maxx=abs (a[i]);
if(maxy
maxy=abs (b[i]);
}
s=maxx*maxy;
printf("\nDien tich hinh chu nhat co cac canh song song voi truc toa do la :%f",s);
dmax=e=0;
for(i=1;i<=n;i++)
{
e=sqrt(a[i]*a[i]+b[i]*b[i]);
if(dmax
dmax=e;
}
printf("\nDuong tron tam O, chua cac diem co ban kinh nho nhat la:%f",dmax);
getch();
}