clanguage07@gmail.com

clanguage07@gmail.com

Saturday, June 16, 2012

Write a C program to find both the largest and smallest number in a list of integers.

program:

main( )
{
float largest(float a[ ], int n);
float value[4] = {2.5,-4.75,1.2,3.67};
printf("%f\n", largest(value,4));
}
float largest(float a[], int n)
{
int i;
float max;
max = a[0];
for(i = 1; i < n; i++)
if(max < a[i])
max = a[i];
return(max);
}

No comments:

Post a Comment

GET MORE INFORMATION

http://ads.qadservice.com/t?id=c2168e05-8974-4816-872a-91936ff7379d&size=1024x768&drct=true