program to find a smallest number in an array

Answer Posted / .::get lost::.

#include<stdio.h>
#include<conio.h>

void 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);
getch();
}

Is This Answer Correct ?    24 Yes 10 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Why do we need volatile in c?

750


main() { int i = 10; printf(" %d %d %d ", ++i, i++, ++i); }

642


What is the purpose of void in c?

626


If fflush wont work, what can I use to flush input?

623


Write a program to know whether the input number is an armstrong number.

675






Explain what is wrong with this program statement? Void = 10;

768


What are the types of data structures in c?

606


What is difference between structure and union with example?

603


What is p in text message?

546


Explain how can a program be made to print the name of a source file where an error occurs?

695


What is fflush() function?

649


What is a substring in c?

595


Is there a built-in function in C that can be used for sorting data?

751


What are the types of bitwise operator?

669


What is methods in c?

652