program to find a smallest number in an array

Answer Posted / anu

#include<iostream.h>
#include<conio.h>
void main()
{
int a[20],n,i,s;
clrscr();
cout<<"Enter valur of n";
cin>>n;
cout<<"Enter the elements";
for(i=0;i<n;i++)
{
cin>>a[i];
}
s=a[0];
for(i=0;i<n;i++)
{
if(s>a[i])
{
s=a[i];
}
}
cout<<"The smallest number is"<<s
getch();
}

Is This Answer Correct ?    10 Yes 7 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

write a program to generate address labels using structures?

4013


p*=(++q)++*--p when p=q=1 while(q<=6)

1272


What are types of functions?

571


Why string is used in c?

586


"%u" unsigned integer print the a) address of variable b) value of variable c) name of a variable d) none of the above

617






If errno contains a nonzero number, is there an error?

812


a) Identify the following declarations. Ex. int i (integer variable) float a[l0](array of 10 real nos) int (*f())() void *f int (*f()) [] void *f int f[] [] [] char *(*f) () int (*f[]) [] float(*f) [] [] float **f int ******f

1589


What are preprocessor directives in c?

643


What is a char c?

599


How are Structure passing and returning implemented by the complier?

719


How variables are declared in c?

576


What do you mean by a sequential access file?

631


Write a code of a general series where the next element is the sum of last k terms.

598


what is the difference between 123 and 0123 in c?

729


What is malloc and calloc?

578