Write a program to find the smallest and largest element in
a given array in c language
Answer Posted / dally
#include<stdio.h>
int main()
{
int a[]= {4,3,6,7};
int l.n = 0;
int s.n = 9;
int i=0;
while(a[i] != '\0')
{
if(a[i]>= l.n)
l.n = a[i];
else if(a[i]<=s.n)
s.n = a[i]
i++;
}
printf("%d %d",s.n,l.n) ;
}
| Is This Answer Correct ? | 45 Yes | 51 No |
Post New Answer View All Answers
What are high level languages like C and FORTRAN also known as?
What is the value of h?
What do you know about the use of bit field?
How can I call a function with an argument list built up at run time?
Are enumerations really portable?
how can f be used for both float and double arguments in printf? Are not they different types?
Why is c known as a mother language?
What is use of bit field?
What is abstract data structure in c?
Explain the difference between structs and unions in c?
What does node * mean?
What is meant by errors and debugging?
How can I insert or delete a line (or record) in the middle of a file?
Explain how can you restore a redirected standard stream?
Why is c called c?