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


Please Help Members By Posting Answers For Below Questions

What is the use of printf() and scanf() functions?

640


Why do we use & in c?

595


Study the following C program :call_me (myvar)int myvar;{ myvar +- 5; }main(){int myvar;myvar = 3;call_me(myvar);printf("%d ",myvar);What will be printed a) 3 b) 5 c) 8 d) symbol

670


What is the use of ?: Operator?

671


Explain enumerated types in c language?

608






Explain how do you determine whether to use a stream function or a low-level function?

632


What is the meaning of ?

628


For what purpose null pointer used?

611


a c code by using memory allocation for add ,multiply of sprase matrixes

2306


Is there any data type in c with variable size?

636


Explain what is a pragma?

596


What is p in text message?

544


What is spaghetti programming?

674


What is clrscr ()?

641


Explain what are run-time errors?

614