0% found this document useful (0 votes)
15 views6 pages

Trần Quốc Khánh

Uploaded by

khanhtqn123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
0% found this document useful (0 votes)
15 views6 pages

Trần Quốc Khánh

Uploaded by

khanhtqn123
Copyright
© © All Rights Reserved
We take content rights seriously. If you suspect this is your content, claim it here.
Available Formats
Download as DOCX, PDF, TXT or read online on Scribd
You are on page 1/ 6

Bài 1:

#include <iostream>
using namespace std;
int main()
{
double x;
cout<<"so thuc x la: ";
cin>>x;
cout<<"phan nguyen cua so thuc "<< x <<" la: "<<static_cast<int>(x);
return 0;
}

Bài 2:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
const double pi=3.14;
double r;
cout<<"nhap ban kinh cua hinh tron: ";
cin>>r;

double chuvi=2 * pi *r;


double dientich=pi * r * r;

int solechuvi= (chuvi - int(chuvi)) * 100;


int soledientich= (dientich - int(dientich)) * 100;

cout << "chu vi cua hinh tron la: " << solechuvi << endl;
cout << "dien tich cua hinh tron la: " << soledientich << endl;
return 0;
}
Bài 3:
#include <iostream>
using namespace std;
int main()
{
double giovao, giora, tiengio, tongtien;
int binhnuoc, tiennuoc;
cout<<"nhap gio vao: ";
cin>>giovao;

cout<<"nhap gio ra: ";


cin>>giora;

cout<<"nhap so binh nuoc da uong: ";


cin>>binhnuoc;

tiengio=(giora-giovao)*200000;
cout<<"tien gio la: "<<tiengio<<" VND"<<endl;

tiennuoc=binhnuoc*20000;
cout<<"tien nuoc la: "<<tiennuoc<<" VND"<<endl;

tongtien=tiengio + tiennuoc;
cout<<"tong tien phai tra la: "<<tongtien<<" VND"<<endl;
return 0;
}

Bài 4:
#include <iostream>
using namespace std;
int main()
{
double toan,ly,hoa,dtb;
cout<<"nhap diem 3 mon toan, ly, hoa: ";
cin>>toan>>ly>>hoa;

dtb= ((toan + ly + hoa) * 3) / 9;


cout<<"dtb cua sinh vien do la: "<<dtb;
return 0;
}

Bài 5:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int chieudai, chieurong;
double dientich, chuvi, dodaidc;

cout<<"nhap chieu dai, chieu rong cua HCN: ";


cin>>chieudai>>chieurong;

dientich=double(chieudai * chieurong);
chuvi=double((chieudai + chieurong)*2);
dodaidc=double(sqrt(pow(chieudai,2) + pow(chieurong,2)));

cout<<"dien tich HCN la: "<<dientich<<endl;


cout<<"chuvi HCN la: "<<chuvi<<endl;
cout<<"dodaidc HCN la: "<<dodaidc<<endl;
return 0;
}

Bài 6:
#include <iostream>
using namespace std;
int main()
{
int tuoi,namsinh;
cout<<"nhap tuoi: ";
cin>>tuoi;

namsinh=2024 - tuoi;
cout<<"nam sinh cua nguoi do la: "<<namsinh;
return 0;

Bài 7:

#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int x;
double f;

cout << "nhap x: ";


cin >> x;

f = (3 * pow(x,2) + 5 * x + 7) / (2 * x + 1);
cout << "gia tri bieu thuc f(X) la: " << f << endl;
return 0;
}

Bài 8:
#include <iostream>
#include <cmath>
using namespace std;
int main()
{
int x;
double f;

cout << "nhap x: ";


cin >> x;

f= (3 * pow(x,5) + 4 * x + sqrt(x + 1)) / (5 * pow(x,2) - 2);


cout << "gia tri bieu thuc f(X) la: " << f << endl;
return 0;
}

Bài 9:
#include <iostream>
#include <iomanip>
using namespace std;
int main()
{
int phannguyen,phanthapphan;
double sothuc;
cout<<"nhap so thuc: ";
cin>>sothuc;

phannguyen=int(sothuc);
phanthapphan= (sothuc - phannguyen) * 100;

cout<<"phan nguyen cua so thuc la: "<<phannguyen<<endl;


cout<<"so thuc voi 2 so thap phan la: "<< fixed <<
setprecision(2)<<sothuc<<endl;
cout<<"2 so thap phan cua so thuc la: "<<phanthapphan<<endl;
cout<<"tong phan nguyen va 2 so thap phan cua so thuc la: "<<phannguyen
+phanthapphan<<endl;
return 0;
}

Bài 10:
#include <iostream>
using namespace std;
int main()
{
int sanpham;
double dongia, tien, thue, tong;

cout<<"nhap so luong san pham: ";


cin>>sanpham;
cout<<"nhap gia tien cua san pham: ";
cin>>dongia;

tien=sanpham * dongia;
thue=tien* 0.05;
tong=tien + thue;

cout<<"so tien cua "<<sanpham<<" san pham la: "<<tien<<" VND"<<endl;


cout<<"so tien thue phai tra la: "<<thue<<" VND"<<endl;
cout<<"tong so tien cua "<<sanpham<<" san pham sau khi da dong thue la:
"<<tong<<" VND"<<endl;

You might also like