//Tinh chu vi, dien tich hinh tron //Publisher: Tran Vo Tien Do //Github: https://github.com/tranvotiendo //Tính chu vi, diện tích hình tròn //Publisher: Tran Vo Tien Do //Github: https://github.com/tranvotiendo //Date: 14-May-2023 #include <bits/stdc++.h> using namespace std; double c,s,r; double ChuVi (double r) { double cv = 2*3.14*r; return cv; } double DienTich (double r) { double dt = 3.14 * r*r; return dt; } int main (){ cout<<"Nhap vao gia tri cua ban kinh, r= "; cin>>r; c=ChuVi(r); s=DienTich(r); cout<<"Chu vi la: "<<c<<endl; cout<<"Dien tich la: "<<s; return 0; }
//Tim so nho nhat trong 3 so - Sử dụng hàm //Publisher: Tran Vo Tien Do //Github: https://github.com/tranvotiendo #include <bits/stdc++.h> using namespace std; float minn (float a, float b) { if (a<b) return a; return b; } int main (){ cout<<"Nhap vao gia tri cua 3 so a,b,c= "; float a, b, c, m; cin>>a>>b>>c; m=minn(minn(a,b),c); cout<<"So nho nhat la: "<<m; return 0; }
//Tim so lon nhat trong 3 so //Publisher: Tran Vo Tien Do //Github: https://github.com/tranvotiendo #include <bits/stdc++.h> using namespace std; float maxx (float a, float b) { if (a>b) return a; return b; } int main (){ cout<<"Nhap vao gia tri cua 3 so a,b,c= "; float a, b, c, m; cin>>a>>b>>c; m=maxx(maxx(a,b),c); cout<<"So lon nhat la: "<<m; return 0; }
//Kiểm tra tính chẵn lẻ của số nguyên N với N nhập từ bàn phím. //Trong chương trình có sử dụng chương trình con kiểm tra tính chẳn lẻ kiemtra(n) //Publisher: Tran Vo Tien Do //Github: https://github.com/tranvotiendo #include <bits/stdc++.h> using namespace std; void kiemtra(int n) { if (n%2==0) cout<<n<<" la so chan"; else cout<<n<<" la so le"; } int main (){ cout<<"Nhap vao gia tri cua n= "; int n; cin>>n; kiemtra(n); return 0; }
--------------------------------------------------------------------------------------------