Back
Thuc_Hanh_2.cpp
Save
// Thuc_Hanh_2.cpp #include
#include
using namespace std; void BaiToan1() { int n, gt; do { cout<<"Nhap n: "; cin>>n; } while (n < 0); gt = 1; for (int i = 1; i <= n; i++) { gt = gt * i; } cout<
>n; if (n % 2 == 0) { for (int i = 0; i <= n; i++) { f += (float)1/pow(2, i); } } else { f = sqrt(pow(n, 2) + 1); } cout<<"F = "<
>x; do { cout<<"Nhap n: "; cin>>n; } while (n < 0); if (n % 2 == 0) { for (int i = 1; i <= n; i++) { s += pow(x, i)/pow(3, i - 1); } } cout<<"S = "<
>n; } while (n < 0); while (n > 0) { kq = kq * 10 + n % 10; n = n / 10; } cout<<"Ket qua: "<
>n; for (int i = 2; i < n; i++) { nguyento = true; for (int j = 2; j <= round(sqrt(i)); j++) { if (i % j == 0) { nguyento = false; break; } } if (nguyento) cout<
>n; x = (int)sqrt(n); if (pow(x, 2) == n) { cout<
>luachon; switch (luachon) { case 1: BaiToan1(); break; case 2: BaiToan2(); break; case 3: BaiToan3(); break; case 4: BaiToan4(); break; case 5: BaiToan5(); break; case 6: BaiToan6(); break; case 0: exit(0); default: cout<<"Lua chon khong dung"; } return 0; }