kiem tien, kiem tien online, kiem tien truc tuyen, kiem tien tren mang
Thứ Hai, 23 tháng 3, 2015


Đề bài: Tìm các bộ ba số nguyên dương (x,y,z) (x,y,z<100) vừa thỏa mãn công thức Pitago: x*x + y*y = z*z , đồng thời vừa là 3 số nguyên liên tiếp hoặc 3 số chẵn liên tiếp

Bài giải:

#include <stdio.h>
int main(){
for
(int x=1; x<100;x++){
int
y = x+1;
int
z = y+1;
if
(x*x+y*y==z*z)
printf("(%d , %d, %d)\n",x,y,z);
if
(x%2==0)
{

y=x+2;
z=y+2;
if
(x*x+y*y==z*z)
printf("(%d , %d, %d)\n",x,y,z);
}
}

return
0;
}
23 Mar 2015

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