رد: [cpcs 202 - برمجة 1] لديك سؤال , شيء غير مفهوم ,,, تفضل هنا , موضوع مفيد
بليز مستر احمد ممكن تحللي هاذي ومع الشرح لاهنت لاني حاولت احلها يمين ويسار ما هي راضيه تطلع بليززز::
Write a function that converts dollars to riyals. Try three test cases on this function. Apply the Software Development Method to solve this problem.(Note: 1 Dollars = 3.76 Riyals)
Build a library called math_shapes.h that contains of the 2 functions described in Program 4:
1. circle_area() 2. circle_circum()
هاذا هواااا البرنامج ::::#include <stdio.h>
#define Pi 3.14159
double circle_area(double radius)
{
double result;
/* 1. Calculate the area */
result = Pi * radius * radius;
return (result);
}
double circle_circum(double radius)
{
return (2 * Pi * radius);
}
int main(void)
{
double radius; // input
double area; // output – area of a circle
double circum; // output – circumference
/* 1. Get the circle radius */
printf("Enter radius> ");
scanf("%lf", &radius);
/* 2&3. Calculate the area & circumference */
area = circle_area (radius);
circum = circle_circum (radius);
/* 4&5. Display the area & circumference */
printf("The area is %.4f\n", area);
printf("The circumference is %.4f\n", circum);
return(0);
}
|