wap in c to accept n number display the highest and lowest
value

Answer Posted / abhilash.d

void main()
{
int n,a[],j,l;
printf("enter the no.of numbers to accept");
scanf("%d",&n);
printf("enter the numbers");
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
for(i=0;i<n;i++)
{
for(j=1;j<=i;j++)
{
if(a[i]<a[j])
{
l=a[i];
a[j]=a[i];
a[i]=l;
}
}
}
printf("highest value is:"a[0]);
printf("lowest value is:"a[0+n-1]);
}

Is This Answer Correct ?    10 Yes 3 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain the use of 'auto' keyword

668


How can I open files mentioned on the command line, and parse option flags?

583


How do you determine a file’s attributes?

591


what is diffrence between linear and binary search in array respect to operators?what kind of operator can be used in both seach methods?

1444


What is the use of f in c?

551






How main function is called in c?

620


When should a type cast not be used?

618


What is operator precedence?

637


Explain 'bus error'?

547


Tell us bitwise shift operators?

590


C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions

603


Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..

638


Explain the difference between malloc() and calloc() function?

594


How can you pass an array to a function by value?

597


Are the outer parentheses in return statements really optional?

568