write a program to fined second smallest and largest element
in a given series of elements (without sorting)
Answer Posted / mohit kumar
#include<stdio.h>
#include<conio.h>
void main()
{
int a[10],max,min,i,temp;
printf("\n enter array element");
for(i=0;i<10;i++)
{
scanf("%d",&a[i]);
}
//second smallest number
min=a[0];
for(i=0;i<10;i++)
{
if(min>a[i])
{
min=a[i];
}
| Is This Answer Correct ? | 20 Yes | 39 No |
Post New Answer View All Answers
write a c program to calculate sum of digits till it reduces to a single digit using recursion
Between macros and functions,which is better to use and why?
Can i use “int” data type to store the value 32768? Why?
A text file that contains declarations used by a group of functions,programs,or users a) executable file b) header file c) obj file d) .cfile
What is the purpose of realloc()?
Explain goto?
How can I find the modification date and time of a file?
Can you think of a logic behind the game minesweeper.
What is a static function in c?
given post order,in order construct the corresponding binary tree
What is sizeof in c?
What is .obj file in c?
List the difference between a While & Do While loops?
main() { struct s1 { char *str; struct s1 *ptr; }; static struct s1 arr[] = { {"Hyderabad",arr+1}, {"Bangalore",arr+2}, {"Delhi",arr} }; struct s1 *p[3]; int i; < BR> for(i=0;i<=2;i++) p[i] = arr[i].ptr; printf("%s ",(*p)->str); printf("%s ",(++*p)->str); printf("%s ",((*p)++)->str); }
How will you write a code for accessing the length of an array without assigning it to another variable?