program to find a smallest number in an array

Answer Posted / azhar shaik

int n, i,small,a[30];
clrscr();
pf("enter the no.of elements in an array");
sf("%d",&n);
pf("enter the elements \n");
for(i=0;i<n;i++)
{
pf("a[%d]= ,"i);
sf("%d\n",&ai[i]);
}
pf(" displaty the array elements ");
for(i=0;i<n;i++)
{
pf("%d\t",a[i]);
}
pf("smallest element from an array "):
small=a[0];
for(i=1;i<n;i++)
{
if(small>a[i])
{
small=a[i];
}
pf("smallest element is %d ",small);
getch();
}


hint:pf =print f ,sf =scan f

Is This Answer Correct ?    0 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

How is a structure member accessed?

592


What are the two types of functions in c?

577


Write a program to generate random numbers in c?

670


write a c program thal will find all sequences of length N that produce the sum is Zero, print all possible solutions?

2415


What is an arrays?

662






a formula,a series of steps,or well defined set of rules for solving a problem a) algorithem b) program c) erdiagram d) compiler

622


What is formal argument?

656


Difference between malloc() and calloc() function?

660


Where we use clrscr in c?

716


What is malloc return c?

603


How can I convert a number to a string?

614


What is a newline escape sequence?

672


What is extern storage class in c?

523


What are runtime error?

640


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

619