program to find a smallest number in an array
Answer Posted / vignesh1988i
i think this logic would work out...
#include<stdio.h>
#include<conio.h>
void main()
{
int n,a[50],temp;
printf("enter the max limit :");
scanf("%d",&n);
for(int i=0;i<n;i++)
scanf("%d",&a[i]);
i=0;
for(int 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 ? | 59 Yes | 30 No |
Post New Answer View All Answers
Write a program to check armstrong number in c?
What is the most efficient way to count the number of bits which are set in an integer?
Explain the properties of union.
What is the correct code to have following output in c using nested for loop?
What does 3 mean in texting?
What are file streams?
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
Why n++ execute faster than n+1 ?
What is a string?
Implement bit Array in C.
find out largest elemant of diagonalmatrix
Is it better to bitshift a value than to multiply by 2?
A collection of data with a given structure for excepting storing and providing on demand data for multiple users a) linked list b) datastructer c) database d) preprocessor
what is the significance of static storage class specifier?
What does != Mean in c?