program to find a smallest number in an array

Answer Posted / rose

#include<stdio.h>
#include<conio.h>
void main()
{
int n,a[50],temp;
printf("enter the max limit :");
scanf("%d",&n);
for(i=0;i<n;i++)
scanf("%d",&a[i]);
i=0;
for(j=0;j<n-1;j++)
{
if(a[j+1]<a[j])
{
temp=a[j+1];
a[j+1]=a[j];
a[j]=temp;
}
}
printf("the smnallest is : %d",*(a+0));
getch();
}

Is This Answer Correct ?    19 Yes 15 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is meant by errors and debugging?

655


Explain how do you use a pointer to a function?

643


What is ctrl c called?

605


praagnovation

1785


why we wont use '&' sing in aceesing the string using scanf

1789






find the sum of two matrices and WAP for it.

642


Who invented bcpl language?

711


What is static and auto variables in c?

571


How do you declare a variable that will hold string values?

676


List the difference between a "copy constructor" and a "assignment operator"?

587


Can a void pointer point to a function?

581


what is the c source code for the below output? 10 10 10 10 10 10 10 10 10 10 9 9 7 6 6 6 6 6 6 9 7 5 9 7 3 2 2 5 9 7 3 1 5 9 7 3 5 9 7 4 4 4 4 5 9 7 8 8 8 8 8 8 8 8 9

1438


What are the types of type qualifiers in c?

658


When is a null pointer used?

646


What is the difference between far and near ?

691