منتديات الجلفة لكل الجزائريين و العرب - عرض مشاركة واحدة - مسااااعدة من فضلكم ******** c
عرض مشاركة واحدة
قديم 2011-12-16, 01:11   رقم المشاركة : 2
معلومات العضو
AbdessamedOuargla
عضو جديد
 
إحصائية العضو










افتراضي

كود:
 #include<stdio.h>

float function( char name[], float p1, float p2, float p3)
{
float moyg, min, moy, max;
printf("The name of the student:%s\n", name);
moyg = (p1+p2+p3)/3;
printf("The average of the student is: %.2f\n", moyg);
if (p1==p2 && p1==p3)
{
printf("All the points are equal and is: %.f\n", p1);
goto end;
}
if (p1>p2 && p1>p3)
{
max=p1;
if(p2>p3)
{
moy=p2;
min=p3;
}
else
{
moy=p2;
min=p3;
}
}
else if (p2>p1 && p2>p3)
{
max=p2;
if(p1>p3)
{
moy=p1;
min=p3;
}
else

{
moy=p3;
min=p1;
}
}

else

{
max=p3;
if (p1>p2)
{
moy=p1;
min=p2;
}
else

{
moy=p2;
min=p1;
}

printf(
" the max point is: %.2f\n", max);
printf(" the moy point is: %.2f\n", moy);
printf(" the min point is: %.2f\n", min);
end:
return 0;
}
}

int
main(void)
{
float n1, n2, n3;
char names[100];
printf("Give the name of the student: ");
gets(names);
printf("Give the first point: ");scanf("%f", &n1);
printf("Give the second point: ");scanf("%f", &n2);
printf("Give the third point: ");scanf("%f", &n3);
function(names, n1, n2, n3);
system("pause");
}