Cプログラミング
 Computer >> コンピューター >  >> プログラミング >> Cプログラミング

円の面積を見つけるためのプログラムのためのCプログラム?


面積は、図の範囲を2次元で表す量です。円の面積は、2次元平面で円がカバーする面積です。

円の面積を見つけるには、radius[r]またはdiameter[d](2 * radius)が必要です。

面積の計算に使用される式は(π* r 2 )または{(π* d 2 )/4}。

サンプルコード

半径を使用して円の面積を見つけるには。

#include <stdio.h>
int main(void) {
   float pie = 3.14;
   int radius = 6;
   printf("The radius of the circle is %d \n" , radius);
   float area = (float)(pie* radius * radius);
   printf("The area of the given circle is %f", area);
   return 0;
}

出力

The radius of the circle is 6
The area of the given circle is 113.040001

サンプルコード

math.hライブラリを使用して半径を使用して円の面積を見つけるには。数学クラスのpow関数を使用して、指定された数の2乗を見つけます。

#include <stdio.h>
int main(void) {
   float pie = 3.14;
   int radius = 6;
   printf("The radius of the circle is %d \n" , radius);
   float area = (float)(pie* (pow(radius,2)));
   printf("The area of the given circle is %f", area);
   return 0;
}

出力

The radius of the circle is 6
The area of the given circle is 113.040001

サンプルコード

直径を使用して円の面積を見つけるには。

#include <stdio.h>
int main(void) {
   float pie = 3.14;
   int Diameter = 12;
   printf("The Diameter of the circle is %d \n" , Diameter);
   float area = (float)((pie* Diameter * Diameter)/4);
   printf("The area of the given circle is %f", area);
   return 0;
}

出力

The Diameter of the circle is 12
The area of the given circle is 113.040001

  1. 円の周囲を見つけるJavaプログラム

    この記事では、円の周囲を見つける方法を理解します。円周は円の周囲長です。円周の距離です。 円周は式C=2𝜋 \ pi rで与えられます。ここで、\pi𝜋 =3.14、rは円の半径- 以下は同じのデモンストレーションです- 入力 入力が-であると仮定します Radius of the circle : 5 出力 必要な出力は-になります Perimeter of Circle is: 31.428571428571427 アルゴリズム Step 1 - START Step 2 - Declare 2 double values namely my_radius an

  2. 台形の領域を見つけるJavaプログラム

    この記事では、台形の領域を見つける方法を理解します。台形は、少なくとも1対の辺が互いに平行な四辺形の一種です。台形の平行な側面はベースと呼ばれ、台形の非平行な側面は脚と呼ばれます。台形とも呼ばれます。 台形の面積は、式-を使用して計算されます。 (height/2 * (side_1 + side_2). i.e. Area = ½ x (sum of the lengths of the parallel sides) x perpendicular distance between parallel sides 以下は同じもののデモンストレーションです。平行な辺aとbの長