周长与面积的计算-题解

描述

请计算出一个半径为r的圆的周长和面积,PI取3.14,最终结果保留整数位即可
圆的周长 = 2*r*PI
圆的面积 = r*r*PI

输入描述

输入一个整数,表示r。(r在int范围内)

输出描述

输出两行,第一行表示周长,第二行表示面积

用例输入 1

1
5

用例输出 1

1
2
31
78

用例输入 2

1
6

用例输出 2

1
2
37
113

代码

1
2
3
4
5
6
7
8
9
10
11
#include <bits/stdc++.h>  
using namespace std;
int main(){
int i;
cin >> i;
int ans = i * 2 * 3.14;
cout << ans << endl;
ans = i * i *3.14;
cout << ans;
return 0;
}

周长与面积的计算-题解
https://chenxi-tijie.pages.dev/2025/06/周长与面积的计算-题解/
作者
chenxi
发布于
2025年6月8日
许可协议