Viết chương trình nhập vào 3 số a, b, c. Kiểm tra chúng có phải là bộ số pitago hay không?
Hãy nhập câu hỏi của bạn vào đây, nếu là tài khoản VIP, bạn sẽ được ưu tiên trả lời.
#include <bits/stdc++.h>
using namespace std;
long long n;
int main()
{
cin>>n;
if (n%2==0) cout<<"La so chan";
else cout<<"La so le";
return 0;
}
Tham khảo!
program baitap;
uses crt;
var a:integer;
procedure chanle(x:integer);
begin
if ((x mod 2) = 0) then write('So nhap vao la so chan.') else
write('So nhap vao la so le.');
end;
begin
clrscr;
write('Nhap a: ');readln(a);
chanle(a);
readln;
end
Bài 3:
#include <bits/stdc++.h>
using namespace std;
long long n,i,t;
int main()
{
cin>>n;
t=0;
for (i=1; i<=sqrt(n); i++)
if (i==n/i) t=t+i;
else t=t+i+n/i;
if (t==n) cout<<"Day la so hoan hao";
else cout<<"Day khong la so hoan hao";
return 0;
}
#include <bits/stdc++.h>
using namespace std;
double a,b,cv,dt;
int main()
{
cin>>a>>b;
cv=(a+b)*2;
dt=a*b;
cout<<fixed<<setprecision(2)<<cv<<endl;
cout<<fixed<<setprecision(2)<<dt;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
int dv,ch,tr,n;
int main()
{
cin>>n;
dv=n%10;
ch=n/10; ch=ch%10;
tr=n/100;
cout<<dv<<endl;
cout<<ch<<endl;
cout<<tr;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
double a,b;
int main()
{
cin>>a>>b;
cout<<"a truoc khi doi la:"<<fixed<<setprecision(2)<<a<<endl;
cout<<"b truoc khi doi la:"<<fixed<<setprecision(2)<<b<<endl;
swap(a,b);
cout<<"a sau khi doi la:"<<fixed<<setprecision(2)<<a<<endl;
cout<<"b sau khi doi la:"<<fixed<<setprecision(2)<<b;
return 0;
}
#include <bits/stdc++.h>
using namespace std;
double a,b;
int main()
{
cin>>a>>b;
cout<<fixed<<setprecision(2)<<pow((2*a+5*b),2);
return 0;
}
#include <bits/stdc++.h>
using namespace std;
long double a,b,c;
bool kt;
int main()
{
cin>>a>>b>>c;
kt=false;
if (a*a==b*b+c*c) kt=true;
if (b*b==a*a+c*c) kt=true;
if (c*c==a*a+b*b) kt=true;
if (kt==true) cout<<"YES";
else cout<<"NO";
return 0;
}