30-11-2010, 08:59 PM
|
#4
|
تاريخ التسجيل: Nov 2010
التخصص: ????
نوع الدراسة: إنتظام
المستوى: الثالث
الجنس: ذكر
المشاركات: 283
|
رد: سؤال في كلاس وورك 5 في البرمجة مساعدة .
أولا : السؤال فيه خطأ
وهذا التصحيح
" 1. Write a program using two functions, one to calculate the hypotenuse (H)
and the another to calculate the area of a triangle
"
ثانيا : السؤال طلب منك تكتب برنامج في 2 فنكشن الأولى تحسب hypotenuse (H) والثانية تحسب area of a triangle
هذا كود البرنامج
كود PHP:
#include <stdio.h>
#include <math.h>
double H(double a,double b)
{
return(sqrt(pow(a,2))+ pow(b,2));
}
double area (double a,double b)
{
return((a * b)/2);
}
int main ()
{
double a,b;
printf(" Enter a>> \n");
scanf("%lf",&a);
printf(" Enter b>> \n");
scanf("%lf",&b);
printf(" the hypotenuse ==> %.2f\n",H(a,b));
printf(" the area ==> %.2f\n\n",area(a,b));
return(0);
}
ورقم 2
كود PHP:
#include <stdio.h>
#include <math.h>
int main(void)
{
double x,y,z,v;
printf("Enter the number : \n");
scanf("%lf",&x);
y = pow(sin(x),2);
z = pow(cos(x),2);
v = y + z;
printf("v is=%.2f \n",v);
return (0);
}
وآسف على القصور
... تحياتـــي ...
|
|
|
|
|