Last active
September 16, 2018 12:49
-
-
Save tabvn/aca897c205ef28893f2e747812b2019b to your computer and use it in GitHub Desktop.
bai tap c++ can ban, hinh hop
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
// | |
// main.cpp | |
// homework | |
// | |
// Created by Toan on 9/16/18. | |
// Copyright © 2018 Toan. All rights reserved. | |
// | |
#include <iostream> | |
#include "math.h" | |
using namespace std; | |
int main(){ | |
int s1,s2,s3; // Gia tri dien tich cua cac mat hinh hop chu nhat | |
int a,b,c; // Lan luot la 3 canh cua hinh hop chu nhat | |
int p1,p2,p3; // Lan luot la chu vi | |
int t; // Tong chu vi | |
cout << "Nhap S1:"; | |
cin >>s1; | |
cout << "Nhap S2:"; | |
cin >> s2; | |
cout << "Nhap S3:"; | |
cin >> s3; | |
// tinh canh C | |
double tmp = (double)((s1*s3)/s2); | |
c = sqrt(tmp); | |
/* | |
tinh A | |
*/ | |
a = s1/c; | |
// Tinh B | |
b = s3/c; | |
p1 = 2*(a+c); | |
p2 = 2*(a+b); | |
p3 = 2*(b+c); | |
t = p1+p2+p3; | |
cout << "Tong Chu Vi la:" << t; | |
return 0; | |
} | |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment