program to find a smallest number in an array

Answer Posted / belsia

void main()
{
int a[10];
for(i=0;i<10;i++)
scanf("%d",&a[i]);
for(i=0;i<10;i++)
{
if(a[i]>a[i+1])
{
temp=a[i];
a[i]=a[i+1];
a[i+1]=temp;
}
}
printf("The smallest element is %d",a[0]);
getch();
}

Is This Answer Correct ?    7 Yes 17 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What are void pointers in c?

587


Why does the call char scanf work?

632


If one class contains another class as a member, in what order are the two class constructors called a) Constructor for the member class is called first b) Constructor for the member class is called second c) Only one of the constructors is called d) all of the above

634


a single linked list consists of nodes a to z .print the nodes in reverse order from z to a using recursion

2345


What is .obj file in c?

662






What are the two types of functions in c?

585


Can you write a programmer for FACTORIAL using recursion?

622


Are the expressions * ptr ++ and ++ * ptr same?

680


What is the explanation for prototype function in c?

581


What is the purpose of the preprocessor directive error?

705


an expression contains relational operators, assignment operators, and arithmatic operstors. In the absence of parentheses, they will be evaluated in which of the following order a) assignment, relational, arithematic b) arithematic, relational, assignment c) relational, arithematic, assignment d) assignment, arithematic, relational

827


What is oops c?

636


Explain a file operation in C with an example.

677


Give differences between - new and malloc() , delete and free() ?

626


What is array of pointers to string?

587