您好,欢迎访问一九零五行业门户网

平行四边形周长的C程序

我们已知平行四边形的边,任务是生成具有给定边的平行四边形的周长并显示结果
什么是平行四边形?平行四边形是一种二次方程,具有 -
对边平行对角相等多边形对角线互相平分 li>下图所示的“a”和“b”是平行四边形的边,图中所示的边是平行的。
平行四边形的周长/周长定义为 −
平行四边形的周长 = 2(a + b) 
                                             = 2 * a + 2 * b
示例input-: a = 23 and b = 12output-: circumference of a parallelogram is : 70.00input-: a = 16.2 and b = 24output-: circumference of a parallelogram is : 80.4
算法startstep 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程序的详细内容。
其它类似信息

推荐信息