import math
def L(R):
return 2 * math.pi * R
def S(R):
return 2 * math.pi * R * R
r = float(input())
print("Length is " + str(L(r)))
print("Square is " + str(S(r)))
Программа:
Python:
from math import pi
r = float(input('r = '))
C = 2 * pi * r
S = pi * r**2
print(f'C = {round(C, 4)}\nS = {round(S, 4)}')
C++:
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
float r, C, S;
cout << "r = "; cin >> r;
C = 2 * M_PI * r;
S = M_PI * r * r;
cout << "C = " << C << endl << "S = " << S;
}
import math
def L(R):
return 2 * math.pi * R
def S(R):
return 2 * math.pi * R * R
r = float(input())
print("Length is " + str(L(r)))
print("Square is " + str(S(r)))
Программа:
Python:
from math import pi
r = float(input('r = '))
C = 2 * pi * r
S = pi * r**2
print(f'C = {round(C, 4)}\nS = {round(S, 4)}')
C++:
#include <iostream>
#include <math.h>
using namespace std;
int main()
{
float r, C, S;
cout << "r = "; cin >> r;
C = 2 * M_PI * r;
S = M_PI * r * r;
cout << "C = " << C << endl << "S = " << S;
}