program to find a smallest number in an array

Answer Posted / sathish

main()
{
int a[20],n,i,s;
scanf("%d",&n);
for(i=0;i<n;i++)
{
scanf("%d",&a[i]);
}
s=a[0];
for(i=0;i<n;i++)
{
if(s>a[i])
{
s=a[i];
}
}
printf("the smallest number is %d",s);
}

Is This Answer Correct ?    138 Yes 57 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Explain function?

665


How do you define a function?

584


What does do in c?

611


What is a structure in c language. how to initialise a structure in c?

610


Should I learn data structures in c or python?

584






WRITE A CODE IN C TO SEARCH A FILE FROM NOTEPAD FILE.

2030


Explain about the functions strcat() and strcmp()?

599


What does struct node * mean?

603


How can you check to see whether a symbol is defined?

593


What is the need of structure in c?

566


What is external variable in c?

614


write a proram to reverse the string using switch case?

2470


What does *p++ do? What does it point to?

617


c language interview questions & answer

1464


What does p mean in physics?

586