program to find a smallest number in an array
Answer Posted / rose
#include<stdio.h>
#include<conio.h>
void main()
{
int n,a[50],temp;
printf("enter the max limit :");
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
i=0;
for(j=0;j<n-1;j++)
{
if(a[j+1]<a[j])
{
temp=a[j+1];
a[j+1]=a[j];
a[j]=temp;
}
}
printf("the smnallest is : %d",*(a+0));
getch();
}
| Is This Answer Correct ? | 19 Yes | 15 No |
Post New Answer View All Answers
Why doesn't C support function overloading?
Explain 'bit masking'?
What are control structures? What are the different types?
Give a one-line C expression to test whether a number is a power of 2. [No loops allowed - it's a simple test.]
Can stdout be forced to print somewhere other than the screen?
List the different types of c tokens?
What are header files in c?
What are the two forms of #include directive?
How to write c functions that modify head pointer of a linked list?
When should a type cast not be used?
What is use of pointer?
What is use of null pointer in c?
What is the difference between array and linked list in c?
What are categories used for in c?
What is the right way to use errno?