عرض مشاركة واحدة
منتديات طلاب وطالبات جامعة الملك عبد العزيز منتديات طلاب وطالبات جامعة الملك عبد العزيز
  #1  
قديم 13-11-2009, 12:43 PM
الصورة الرمزية Fiery Phoenix

Fiery Phoenix Fiery Phoenix غير متواجد حالياً

جامعي

 
تاريخ التسجيل: Sep 2008
التخصص: CS
نوع الدراسة: إنتظام
المستوى: الثامن
الجنس: ذكر
المشاركات: 171
افتراضي رد: مساعدة في حل واجب البرمجة lab5


كود:
/*
Calculates the hypotenuse and area of a rectangular rectangle 
*/

#include<stdio.h>   /* printf, scanf definitions */ 
#include<math.h>    /* sqrt, pow definitions */

double
hypotenuse(double a,double b)
{
	return(sqrt(pow(a,2)+pow(b,2)));
}

double
area(double a,double b)
{
	return((a+b)/2);
}

int
main(void)
{
	double a;     /* input - length */ 
	double b;     /* input - height */
	
	/* 1&2. Get the height and length from the user. */ 
	printf("Please Enter Rectangle Lenght: ");
	scanf("%lf", &a);
	printf("Please Enter Rectangle Height: ");
	scanf("%lf", &b);
	/* 3&4. Calculate the hypotenuse and area of the rectangle. */
    hypotenuse(a,b);
	area(a,b); 
	/* 5&6. Display the value of both. */ 
	printf("H = %.2f\nA = %.2f\n", hypotenuse, area);

	return(0);
}
ممكن أحد يعلمني فين الخطأ هنا؟ البرنامج اشتغل معاي تمام لكن كل ما ادخل ارقام يطلع لي أصفار، ما يحسبها صح.

 


توقيع Fiery Phoenix  

"After time adrift among open stars, along tides of light and through shoals of dust, I will return to where I began"

 

رد مع اقتباس