我们已知平行四边形的边,任务是生成具有给定边的平行四边形的周长并显示结果
平行四边形是一种二次方程,具有 -
下图所示的“a”和“b”是平行四边形的边,图中所示的边是平行的。
平行四边形的周长/周长定义为 −
平行四边形的周长 = 2(a + b)
= 2 * a + 2 * b
Input-: a = 23 and b = 12 Output-: Circumference of a parallelogram is : 70.00 Input-: a = 16.2 and b = 24 Output-: Circumference of a parallelogram is : 80.4
START Step 1-> Declare function to calculate circumference of parallelogram float circumference(float a, float b) return ((2 * a) + (2 * b)) Step 2-> In main() Declare float a = 23, b = 12 Call circumference(a, b) STOP
#include <stdio.h> //function for circumference of parallelogram float circumference(float a, float b) { return ((2 * a) + (2 * b)); } int main() { float a = 23, b = 12; printf("Circumference of a parallelogram is : %.2f", circumference(a, b)); return 0; }
Circumference of a parallelogram is : 70.00
以上是平行四边形周长的C程序的详细内容。更多信息请关注PHP中文网其他相关文章!