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
What is the use of printf() and scanf() functions?
Why do we use & in c?
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
What is the use of ?: Operator?
Explain enumerated types in c language?
Explain how do you determine whether to use a stream function or a low-level function?
What is the meaning of ?
For what purpose null pointer used?
a c code by using memory allocation for add ,multiply of sprase matrixes
Is there any data type in c with variable size?
Explain what is a pragma?
What is p in text message?
What is spaghetti programming?
What is clrscr ()?
Explain what are run-time errors?