0% found this document useful (0 votes)
20 views30 pages

Phần 1

Uploaded by

pthhanhh777
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)
20 views30 pages

Phần 1

Uploaded by

pthhanhh777
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/ 30

Phần 1:

Bài 1:
#include <iostream>

using namespace std;

int main(){

int a;

cout << "nhap vao mot so nguyen: ";

cin >> a;

if (a%2==0)

cout << "so chan";

else

cout << "so le";

return 0;

Bài 2:
#include <iostream>

using namespace std;

int main(){

int so1, so2;

cout << "nhap vao so thu nhat: ";

cin >> so1;

cout << "nhap vao so thu hai: ";

cin >> so2;

if (so1>so2)

cout << "so thu nhat lon hon ";

else

cout << "so thu hai lon hon ";

return 0;

}
Bài 3:
#include <iostream>

using namespace std;

int main(){

char ng1, ng2;

cout << "nguoi so 1 ra: ";

cin >> ng1;

cout << "nguoi so hai ra: ";

cin >> ng2;

if (ng1 == ng2){

cout << "nguoi choi hoa nhau" << endl;

else if ((ng1 == 'B' && ng2 == 'K')||(ng1 == 'K' && ng2 == 'O')||(ng1 == 'O' && ng2
== 'B')){

cout << "nguoi so 1 thang";

else if ((ng1 == 'B' && ng2 == 'O')||(ng1 == 'K' && ng2 == 'B')||(ng1 == 'O' && ng2
== 'K')){

cout << "nguoi so 2 thang " << endl;

return 0;

Bài 4:
#include <iostream>

using namespace std;

int main(){

float TNCT;

int luong = 650000;

int heso1 = 1.92;

int heso2 = 2.34;

int heso3 = 3;
int heso4 = 4.5;

cout << "tham nien cong tac cua nhan vien la: ";

cin >> TNCT;

if (TNCT<12){

cout << "luong cua nhan vien do la: "<< heso1*luong ;

else if (12<=TNCT && TNCT<36){

cout << "luong cua nhan vien do la: "<< heso2*luong;

else if (36<=TNCT && TNCT <60){

cout << "luong cua nhan vien do la: "<< heso3*luong;

else if (TNCT>=60){

cout << "luong cua nhan vien do la: "<< heso4*luong;

return 0;

Bài 5:
#include <iostream>

using namespace std;

int main(){

int gia = 30000;

int giohatsau4tieng = 21000;

int giobatdau, gioketthuc;

cout << "gio bat dau la: ";

cin >> giobatdau;

if ((giobatdau<8) || (giobatdau>24))

cout << "khong hop le ";

return 0;

}
cout << "gio ket thuc la: ";

cin >> gioketthuc;

if ((gioketthuc>24) || (gioketthuc<8))

cout << "khong hop le";

return 0;

else if ((giobatdau>=8 && gioketthuc<=17) && (gioketthuc-giobatdau)<4)

int giamgia10 = ((gioketthuc-giobatdau)*30000)*0.1;

cout << "so tien phai tra la: " << ((gioketthuc- giobatdau)*gia)-giamgia10;

else if ((giobatdau>=8 && gioketthuc<=17) && (gioketthuc-giobatdau)>=4)

int giamgia = (((gioketthuc-giobatdau)*21000+27000)*0.1);

cout << "so tien phai tra la: " << (((gioketthuc-
giobatdau)*giohatsau4tieng+27000)-giamgia);

else if ((giobatdau>17 && gioketthuc<=24) && ((gioketthuc-giobatdau)<4))

cout << "so tien phai tra la: " << ((gioketthuc-giobatdau)*gia);

else if ((giobatdau>17 && gioketthuc<=24) && ((gioketthuc-giobatdau)>=4))

cout << "so tien phai tra la: " << (((gioketthuc-giobatdau)*21000)+27000);

return 0;

Bài 6:
Bài 7:
#include <iostream>

using namespace std;

int main(){

int so1, so2, so3;

cout << "nhap vao so thu 1: ";

cin >> so1;

cout << "nhap vao so thu 2: ";

cin >> so2;

cout << "nhap vao so thu 3: ";

cin >> so3;

if (so1>so2 && (so1>so3) && (so2>so3)

){

cout << "so thu 1 la so lon nhat"<<endl << "so thu 3 la so nho nhat";

else if ((so1>so2) && (so1>so3) && (so3>so2)

){

cout << "so thu 1 la so lon nhat"<<endl << "so thu 2 la so nho nhat";

else if ((so2>so1) && (so2>so3) && (so1>so3)){

cout << "so thu 2 la so lon nhat" << endl << "so thu 3 la so nho nhat";

else if ((so2>so1) && (so2>so3) && (so3>so1)){

cout << "so thu 2 la so lon nhat" << endl << "so thu 1 la so nho nhat";

else if ((so3>so1) && (so3>so2) && (so1>so2)){

cout << "so thu 3 la so lon nhat" << endl << "so thu 2 la so nho nhat" ;

else if ((so3>so1) && (so3>so2) && (so2>so1)){

cout << "so thu 3 la so lon nhat" << endl << "so thu 1 la so nho nhat";

}
return 0;

Bài 8:
#include <iostream>

using namespace std;

int main(){

int so1, so2, so3, so4;

cout << "nhap vao so thu 1: ";

cin >> so1;

cout << "nhap vao so thu 2: ";

cin >> so2;

cout << "nhap vao so thu 3: ";

cin >> so3;

cout << "nhap vao so thu 4: ";

cin >> so4;

if (so1>so2 && (so1>so3) && (so1>so4) && (so2>so3) && (so4>so3))

cout << "so thu 1 la so lon nhat"<<endl << "so thu 3 la so nho nhat";

else if (so1>so2 && (so1>so3) && (so1>so4) && (so3>so2) && (so4>so2))

cout << "so thu 1 la so lon nhat"<<endl << "so thu 2 la so nho nhat";

else if (so1>so2 && (so1>so3) && (so1>so4) && (so3>so4) && (so2>so4))

cout << "so thu 1 la so lon nhat"<<endl << "so thu 4 la so nho nhat";

else if ((so2>so1) && (so2>so3) && (so2>so4) && (so1>so3) && (so4>so3))

cout << "so thu 2 la so lon nhat" << endl << "so thu 3 la so nho nhat";

}
else if ((so2>so1) && (so2>so3) && (so2>so4) && (so1>so4) && (so3>so4))

cout << "so thu 2 la so lon nhat" << endl << "so thu 4 la so nho nhat";

else if ((so2>so1) && (so2>so3) && (so2>so4) && (so3>so1) && (so4>so1))

cout << "so thu 2 la so lon nhat" << endl << "so thu 1 la so nho nhat";

else if ((so3>so1) && (so3>so2) && (so3>so4) && (so1>so2) && (so4>so2))

cout << "so thu 3 la so lon nhat" << endl << "so thu 2 la so nho nhat" ;

else if ((so3>so1) && (so3>so2) && (so3>so4) && (so2>so1) && (so4>so1))

cout << "so thu 3 la so lon nhat" << endl << "so thu 1 la so nho nhat" ;

else if ((so3>so1) && (so3>so2) && (so3>so4) && (so1>so4) && (so2>so4))

cout << "so thu 3 la so lon nhat" << endl << "so thu 2 la so nho nhat" ;

else if ((so4>so1) && (so4>so2) && (so4>so3) && (so2>so1) && (so3>so1))

cout << "so thu 4 la so lon nhat" << endl << "so thu 1 la so nho nhat";

else if ((so4>so1) && (so4>so2) && (so4>so3) && (so1>so2) && (so3>so2))

cout << "so thu 4 la so lon nhat" << endl << "so thu 2 la so nho nhat";

else if ((so4>so1) && (so4>so2) && (so4>so3) && (so1>so3) && (so2>so3))

cout << "so thu 4 la so lon nhat" << endl << "so thu 3 la so nho nhat";
}

return 0;

Bài 9:
#include <iostream>

using namespace std;

int main(){

int diemtrungbinh;

cout << "diem trung binh cua hoc sinh la: ";

cin >> diemtrungbinh;

if (diemtrungbinh<0 || diemtrungbinh>10)

cout << "khong hop le!";

return 0;

else if (diemtrungbinh>=9)

cout << "hoc sinh dat loai: xuat sac";

else if (diemtrungbinh>=8 && diemtrungbinh<9)

cout << "hoc sinh dat loai: gioi";

else if (diemtrungbinh>=6.5 && diemtrungbinh<8)

cout << "hoc sinh dat loai: kha";

else if (diemtrungbinh>=5 && diemtrungbinh<6.5)

cout << "hoc sinh dat loai: trung binh";

}
else if (diemtrungbinh>=3.5 && diemtrungbinh<5)

cout << "hoc sinh dat loai: yeu";

else

cout << "hoc sinh dat loai: kem";

return 0;

Bài 10:
#include <iostream>

using namespace std;

int main(){

float a, b;

cout << "giai phuong trinh ax+b>0" << endl;

cout << "nhap vao he so a: ";

cin >> a;

cout << "nhap vao he so b: ";

cin >> b;

if (a == 0 && b==0)

cout << "phuong trinh luon dung voi moi x";

else if (a == 0 && b!=0)

cout << "phuong trinh vo nghiem ";

else if (a>0)

cout << "nghiem x cua phuong trinh là: " << -b/a;
}

else if (a<0)

cout << "nghiem x cua phuong trinh là: " << -b/a;

return 0;

Bài 11:
#include <iostream>

using namespace std;

struct phanso {

int tuso;

int mauso;

};

void NhapPS(phanso &x) {

cout << "Tu so la: ";

cin >> x.tuso;

do {

cout << "Mau so la : ";

cin >> x.mauso;

if (x.mauso == 0)

cout << "Khong hop le!" << "\n";

} while (x.mauso == 0);

void xuatraphanso(phanso x) {

cout << x.tuso << "/" << x.mauso;

float tongphanso(phanso x1, phanso x2) {

int tu = x1.tuso * x2.mauso + x2.tuso * x1.mauso;

int mau = x1.mauso * x2.mauso;

return (float)tu / mau;


}

float hieuphanso(phanso x1, phanso x2) {

int tu = x1.tuso * x2.mauso - x2.tuso * x1.mauso;

int mau = x1.mauso * x2.mauso;

return (float)tu / mau;

float tichphanso(phanso x1, phanso x2) {

int tu = x1.tuso * x2.tuso;

int mau = x1.mauso * x2.mauso;

return (float)tu / mau;

float thuongphanso(phanso x1, phanso x2) {

int tu = x1.tuso * x2.mauso;

int mau = x1.mauso * x2.tuso;

return (float)tu / mau;

int main() {

phanso phanso1, phanso2;

cout << "Nhap phan so thu nhat:" << "\n";

NhapPS(phanso1);

cout << "Nhap phan so thu hai:" << "\n";

NhapPS(phanso2);

cout << "\n" <<"Phan so thu nhat la: ";

xuatraphanso(phanso1);

cout << "\n" <<"Phan so thu hai la: ";

xuatraphanso(phanso2);

cout << "\n" << "\n" <<"Tong hai phan so la: " << tongphanso(phanso1, phanso2);

cout << "\n" << "Hieu hai phan so la: " << hieuphanso(phanso1, phanso2);

cout << "\n" << "Tich hai phan so la: " << tichphanso(phanso1, phanso2);

cout << "\n" <<"Thuong hai phan so la: " << thuongphanso(phanso1, phanso2);
cout << endl;

return 0;

Bài 12:
#include <iostream>

#include <cctype>

using namespace std;

int main() {

char kitu;

cout << "Nhap vao mot ki tu: ";

cin >> kitu;

if (isupper(kitu))

cout << kitu << " la ki tu in" << endl;

else if (islower(kitu))

cout << kitu << " la ki tu thuong" << endl;

else if (isdigit(kitu))

cout << kitu << " la chu so" << endl;

else

cout << kitu << "la ki tu khac";

}
return 0;

Bài 13:
#include <iostream>

using namespace std;

int main(){

int luongdientieuthu;

cout << "so dien da tieu thu thang nay la: ";

cin >> luongdientieuthu;

if (luongdientieuthu<=0)

cout << "khong hop le!";

return 0;

else if (luongdientieuthu<=100)

int thue1;

thue1 = ((luongdientieuthu*550)*0.1);

cout << "tien dien thang nay la: " << (luongdientieuthu*550)+thue1 << "
VND";

else if ((luongdientieuthu>100) && (luongdientieuthu<=150))

int thue2;

thue2 = (((luongdientieuthu*900)-35000)*0.1);

cout << "tien dien thang nay la: " << ((luongdientieuthu*900)-35000)+thue2
<< " VND";

else if ((luongdientieuthu>150) && (luongdientieuthu<=200))

int thue3;
thue3 = (((100*550+50*900)+(luongdientieuthu-150)*1250)*0.1);

cout << "tien dien thang nay la: " << ((100*550+50*900)+(luongdientieuthu-
150)*1250)+thue3 << " VND";

else if (luongdientieuthu>200 && luongdientieuthu<=300)

int thue4;

thue4 = (((100*550+50*900+50*1250)+(luongdientieuthu-200)*1450)*0.1);

cout << "tien dien thang nay la: " << (((100*550+50*900+50*1250)+
(luongdientieuthu-200)*1450)+thue4);

else if (luongdientieuthu>300)

int thue5;

thue5 = (((100*550+50*900+50*1250+100*1450)+(luongdientieuthu-
300)*1700)*0.1);

cout << "tien dien thang nay la: " <<


(((100*550+50*900+50*1250+100*1450)+(luongdientieuthu-300)*1700)+thue5);

return 0;

Bài 14:
#include <iostream>

using namespace std;

int main(){

int maso;

cout << "nhap ma so nhan vien (1, 2, 3, 4): ";

cin >> maso;

int luongcodinh, luongcoban, giolam, doanhso, sosanpham, sotiensanpham;

if (maso == 1){

cout << "nhap luong co dinh X: ";

cin >> luongcodinh;


cout << "luong cua nhan vien theo tuan la: " << luongcodinh << " VND";

else if (maso == 2){

cout << "nhap luong co ban: ";

cin >> luongcoban;

cout << "nhap so gio lam trong tuan: ";

cin >> giolam;

if (giolam<=40){

cout << "luong cua nhan vien tuan nay la: " << luongcoban*giolam
<< " VND";

else{

cout << "luong cua nhan vien tuan nay la: " <<
luongcoban*40+luongcoban*1.5*(giolam-40) << " VND";

else if (maso==3){

cout << "nhap doanh so ban duoc: ";

cin >> doanhso;

cout << "luong cua nhan vien tuan nay la: " << doanhso*0.07+500000 << " VND"
;

else if (maso==4){

cout << "nhap so san pham ban duoc: ";

cin >> sosanpham;

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

cin >> sotiensanpham;

cout << "luong cua nhan vien tuan nay la: " << sosanpham*sotiensanpham
<< " VND";

else{

cout << "khong hop le!";

return 0;
}

return 0;

Bài 15:
#include <iostream>

using namespace std;

int main() {

int so;

cout << "nhap vao so nguyen 2 chu so: ";

cin >> so;

if (so < 10 || so > 99) {

cout << "khong hop le" << endl;

return 1;

int hangchuc = so / 10;

int donvi = so % 10;

switch (hangchuc) {

case 1: cout << "muoi "; break;

case 2: cout << "hai muoi "; break;

case 3: cout << "ba muoi "; break;

case 4: cout << "bon muoi "; break;

case 5: cout << "nam muoi "; break;

case 6: cout << "sau muoi "; break;

case 7: cout << "bay muoi "; break;

case 8: cout << "tam muoi "; break;

case 9: cout << "chin muoi "; break;

switch (donvi) {

case 1: cout << "mot"; break;

case 2: cout << "hai"; break;


case 3: cout << "ba"; break;

case 4: cout << "bon"; break;

case 5: cout << "nam"; break;

case 6: cout << "sau"; break;

case 7: cout << "bay"; break;

case 8: cout << "tam"; break;

case 9: cout << "chin"; break;

cout << endl;

return 0;

Bài 16:
#include <iostream>

#include <cmath>

using namespace std;

int main(){

cout << "giai phuon trinh bac 2 ax^2+bx+c=0 :" << endl;

int a, b, c, delta;

cout << "nhap he so a: ";

cin >> a;

cout << "Nhap he so b: ";

cin >> b;

cout << "nhap he so c: ";

cin >> c;

delta = pow (b, 2-(4*a*c));

if (delta>0){

int x1, x2;

x1=((-b+sqrt(delta))/2*a);

x2=((-b-sqrt(delta))/2*a);

cout << "phuong trinh co 2 nghiem: " << "\n" << "x1= " << x1 << "\n" <<
"x2= " << x2;
}

else if (delta=0){

cout << "phuong trinh co nghiem kep: " << "x= "<< -b/2*a;

else if (delta<0){

cout << "phuon trinh vo nghiem! ";

else if ((a==0) && (b==0) && (c==0))

cout << "phuong trinh co vo so nghiem";

else if (a==0 && b!=0){

cout << "nghiem cua phuong trinh X= " << -b/c ;

return 0;

Phần 2:
Bài 1:
#include <iostream>

using namespace std;

int main() {

int n;

long long ketqua = 1;

cout << "nhap vao mot so nguyen duong : ";

cin >> n;

if (n <= 0) {

cout << "khong hop le!" << endl;


return 0;

for (int i = n; i > 0; i -= 2) {

ketqua *= i;

cout << n << "!! = " << ketqua << endl;

return 0;

Bài 2:
#include <iostream>

#include<string.h>

using namespace std;

int main(){

int n;

cout << "nhao vao so nguyen n: ";

cin >> n;

int s1 = 0;

for (int i =1;i <= n;i++){

s1 += i;

cout << "tong cac so nguyen S la: " << s1 << endl;

int s2 = 0;

for (int i = 1; i <= (2*n+1);i+=2){

s2 += i;

cout << "tong cac so nguyen cua S=2n+1 la: " << s2 << endl;

int s3 = 1;

for (int i=1;i<=n;i++){

s3 *=i;
}

cout << "giai thua cua n la: " << s3 << endl;

float s4 = 0;

for (int i=2;i<=n;i++);{

s4 += i/(i(*i+1));

cout << "tong gia tri cua S la: " << s4;

return 0;

Bài 3:
#include <iostream>

using namespace std;

int main(){

int n = 0;

cout << "cac so chia het cho 3 hoac 7 trong khoang tu 1 den 100 la: ";

for ( int i = 1; i <= 100;i++){

if (i % 3 == 0 || i % 7 == 0){

cout << i << " ";

n++;

cout << endl << "cac so chia het cho 3 va 7 trong khoang tu 1 den 100 la: " << n
<< endl;

return 0;

Bài 4:
#include <iostream>

using namespace std;

bool isPrime(int n) {

if (n < 2) return false;

for (int i = 2; i <= n / 2; i++) {


if (n % i == 0) {

return false;

return true;

int main() {

int n;

cout << "Nhap vao mot so nguyen duong: ";

cin >> n;

if (isPrime(n)) {

cout << n << " la so nguyen to " << endl;

} else {

cout << n << " khong phai la so nguyen to " << endl;

return 0;

Bài 5:
#include <iostream>

using namespace std;

int main() {

int n;

cout << "nhap vao mot so nguyen duong: ";

cin >> n;

if (n <= 0) {

cout << "khong hop lle!" << endl;

return 0;

cout << n << " = ";

int i = 2;

while (n > 1) {
if (n % i == 0) {

cout << i;

n /= i;

if (n > 1) cout << " x ";

else {

i++;

cout << endl;

return 0;

Bài 6:
#include <iostream>

using namespace std;

int main() {

int soSinhVien;

cout << "nhap vao so luong sinh vien: ";

cin >> soSinhVien;

if (soSinhVien <= 0) {

cout << "khong hop le!" << endl;

return 0;

float diemTrungBinh[soSinhVien];

float tongDiem = 0;

for (int i = 0; i < soSinhVien; i++) {

cout << "nhap diem trung binh cua sinh vien thu " << i + 1 << ": ";

cin >> diemTrungBinh[i];

tongDiem += diemTrungBinh[i];

cout << "\n diem trung binh cua cac sinh vien la :\n";
for (int i = 0; i < soSinhVien; i++) {

cout << "sinh vien thu " << i + 1 << ": " << diemTrungBinh[i] << endl;

float diemTrungBinhTatCa = tongDiem / soSinhVien;

cout << "\nDiem trung binh cua tat ca sinh vien la : " << diemTrungBinhTatCa << endl;

return 0;

Bài 7:
#include <iostream>

using namespace std;

int main ()

float giaTriTrungBinh = 0;

float n;

float dem =0;

float tong =0;

do

cout << "Nhap vao day so:";

cin >> n;

dem ++;

tong += n;

while(n!=9999);

giaTriTrungBinh =tong/dem;

cout << "Gia tri trung binh la:" << giaTriTrungBinh << endl;

return 0;

Bài 8:
#include<iostream>
using namespace std;

int main()

int n, m;

for (n = 1; n < 10; n++)

for (m = 2; m <= 10; m++)

cout <<n << "*" << m << "=" << n*m <<'\t';

cout << endl;

Bài 9:
#include <cmath>

#include <iostream>

using namespace std;

int main(){

for(double goc = 0;goc <= 180; goc += 5)

double radian = (goc*3.14)/180;

cout << goc << '\t';

cout << "sin = " << sin(radian) << '\t';

cout << "cos = " << cos(radian) << '\t';

cout << '\t' << "tan = " << tan(radian) ;

cout << endl;

return 0;

Bài 10:
#include <iostream>

using namespace std;


int main() {

int M, N;

cout << "Nhap so thu nhat M: ";

cin >> M;

cout << "Nhap so thu hai N: ";

cin >> N;

int a = M, b = N;

while (b != 0) {

int temp = b;

b = a % b;

a = temp;

int ucln = a;

int bcnn = (M * N) / ucln;

cout << "uoc chung lon nhat cua " << M << " va " << N << " la: " << ucln << endl;

cout << "boi chung nho nhat cua " << M << " va " << N << " la: " << bcnn << endl;

return 0;

Bài 11:
#include <iostream>

using namespace std;

int main() {

int ascii = 33;

cout << "Cac ky tu co ma ASCII tu 33 den 255 la: "<< "\n";

while (ascii <= 255) {

cout << "Ma ASCII: " << ascii << " -> Ky tu: " << (char)ascii << " ";

if ((ascii - 33 + 1) % 7 == 0) {

cout << endl;

ascii++;
}

cout << "\n"<<"Ket thuc chuong trinh " << "\n";

return 0;

Bài 12:
#include <iostream>

using namespace std;

int main() {

int n;

cout << "nhap vao so tien can doi : ";

cin >> n;

int giatritien[] = {500, 200, 100, 50, 20, 10, 5, 2, 1};

cout << "so tien doi ra duoc la: " << endl;

for (int i = 0; i < 9; i++) {

int count = n / giatritien[i];

if (count > 0) {

cout << "so to " << giatritien[i] << " nghin dong: " << count << endl;

n = n % giatritien[i];

return 0;

Bài 13 a:
#include <iostream>

#include <cstdlib>

#include <ctime>

using namespace std;

int main()

int i;

int doan;
int soBiMat;

int soLanDoan;

cout << "Nhap vao so bi mat trong doan (1;100): ";

cin >> soBiMat;

if(soBiMat <1 || soBiMat>100)

cout << "So khong hop le "<< endl;

return 0;

cout << "Nhap vao so lan doan toi da ";

cin >> soLanDoan;

//Tao seed chay so ngau nhien

srand(time(0));

for(i = 1;i < soLanDoan ;i++)

// Ham doan so ngau nhien tu 1 den 100

doan = rand() % 100 + 1;

cout << "Lan doan thu " << i << ":" << doan << endl;

if (doan == soBiMat)

cout << "May doan dung, so bi mat la: " << soBiMat << endl;

return 0;

else if (doan < soBiMat)

cout << "So bi mat lon hon " << doan << endl;

else
{

cout << "So bi mat nho hon " << doan << endl;

cout << "May khong doan duoc sau " << soLanDoan << " lan";

Bài 13 b:
#include <iostream>

#include <cstdlib>

#include <ctime>

using namespace std;

int main()

int i;

int doan;

int soBiMat;

int soLanDoan;

srand(time(0));

doan = rand() % 100 + 1;

cout << "Nhap vao so lan doan toi da " ;

cin >> soLanDoan;

cout << "Hay doan mot so trong khoang (1;100)" << endl;

for(i = 1;i <= soLanDoan ;i++)

cout << "Lan doan thu " << i << ":" ;

cin >> doan;

if (doan == soBiMat)
{

cout << "Ban doan dung, so bi mat la: " << soBiMat << endl;

return 0;

else if (doan < soBiMat)

cout << "So bi mat lon hon " << doan << endl;

else

cout << "So bi mat nho hon " << doan << endl;

cout << "Ban khong doan duoc sau " << soLanDoan << " lan";

Bài 14:
#include <iostream>
Using namespace std;
Int main (){
Int n, m;
Cout << “Nhap vao so nguyen n”;
Cin >> n;
for(int i = 0;i<=n;i++){
cout << ;
}
return 0;
}

You might also like