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
Explain the use of 'auto' keyword
How can I open files mentioned on the command line, and parse option flags?
How do you determine a file’s attributes?
what is diffrence between linear and binary search in array respect to operators?what kind of operator can be used in both seach methods?
What is the use of f in c?
How main function is called in c?
When should a type cast not be used?
What is operator precedence?
Explain 'bus error'?
Tell us bitwise shift operators?
C program execution always begins with a) #include b) comment (/*-------*/) c) main() d) declaration instructions
Describe the complexity of Binary search, Quicksort and various other sorting and searching techniques..
Explain the difference between malloc() and calloc() function?
How can you pass an array to a function by value?
Are the outer parentheses in return statements really optional?