寻找圆形周长的C++程序
在本教程中,我们将讨论一个查找圆形周长的程序。
为此,我们将得到圆的半径。我们的任务是计算并打印该圆的周长。
示例
#include<bits/stdc++.h>
using namespace std;
#define PI 3.1415
double circumference(double r){
double cir = 2*PI*r;
return cir;
}
int main(){
double r = 5;
cout << "Circumference : " << circumference(r);
return 0;
}输出
Circumference : 31.415
广告
数据结构
网络
RDBMS
操作系统
Java
iOS
HTML
CSS
Android
Python
C编程
C++
C#
MongoDB
MySQL
Javascript
PHP