Labwork №1. 1)Write a program that calculates a volume of a cylinder.
Forex:
Radius (centimeters) = 5.5
Height of cylinder (cm) = 7
Result:
Volume of the cylinder is 665.23 cm.cube.
2)Write a program that calculates a total surface of a cylinder.
Forex:
Radius (centimeters) = 5.5
Height of cylinder (cm) = 7
Result:
Total surface of the cylinder is: 431.97 cm. square.
3)Write a program that converts pounds into kilograms. (1 pound = 405.9 grams)
Forex:
Enter weight in pounds = 5
Result:
5 pounds = 2.05 kg.
4)Write a program that calculates of series and parallel resistances in electricity.
Forex:
Enter values of R1 and R2 resistances:
R1 = 10 Ohm
R2 = 6 Ohm
Result:
Series resistances R1 and R2 is: 16 Ohm
Parallel resistances R1 and R2 is: 3.75 Ohm
5)Write a program that calculates ampere of electricity if resistance and voltage are given.
Forex:
Enter values of V(voltage) and R (resistance) of electricity:
V = 220 volt
R = 11Ohm
Result:
I = 20 Ampere
6)Write a program that calculates a distance between points given in map if there are 120 kilometers in one centimeter of point.
Forex:
Enter the distance of points in map (in centimeters) : 120
Result:
Then the real distance is : 1440 km.
7)Write a program that calculates a cost of journey with a car.
Forex:
Distance from point A to point B(in km) : 67 km
Car’s fuel consumption for 100 km: 10 litters
Cost of a fuel (92 or 93 type): 110 tenge
Result:
Total cost of journey there and back: 1474 tenge
8)Write a program that calculates a speed of a person who runs some distance.
Forex:
Enter a distance (meters) = 1000 m.
Enter a time he spent to run (mins and seconds) = 3.25
(3.25 = 3 мin 25 sec = 205 sec)
Result:
His speed is = 17.56 km/hour
○чень нужн●!П̰о̰ж̰а̰л̰у̰й̰с̰т̰а̰
ответ: 15
Прога:
/** libraries */
#include <iostream>
#include <cmath>
#include <vector>
#include <map>
#include <set>
#include <queue>
#include <stack>
#include <algorithm>
/** libraries */
using namespace std;
/** defines */
#define ll long long
#define ld long double
#define yes cout << "YES" << "\n"
#define no cout << "NO" << "\n"
/** defines */
ll f(ll num){
ll res = 0;
while(num > 0){
res += 1 - num % 2;
num /= 2;
}
return res;
}
signed main() {
ios_base::sync_with_stdio(false);
cin.tie(nullptr);
cout.tie(nullptr);
ll ans = 0;
for(ll i = 27; i <= 53; i++)
if(f(i) >= 3)
ans++;
cout << ans;
}
#include <bits/stdc++.h>
using namespace std;
int main()
{
int n, k1 = 0,k2 = 0;
cin >> n;
int b = 0;
vector<int> a;
for(int i = 0; i < n; ++i){
cin >> b;
a.push_back(b);
}
for(int i = 0; i < a.size(); ++i)
if(!(a.at(i)%2==0)){
cout << a.at(i) << " ";
k1++;
}
cout << endl;
for(int i = 0; i < a.size(); ++i)
if(a.at(i)%2==0){
cout << a.at(i) << " ";
k2++;
}
cout << endl;
if(k1 > k2)
cout << 3;
else
cout << 4;
return 0;
}