Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

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


Please Help Members By Posting Answers For Below Questions

Explain what is the benefit of using #define to declare a constant?

1095


In C programming, how do you insert quote characters (‘ and “) into the output screen?

1477


What are the 5 types of inheritance in c ++?

967


What is the use of header?

1051


Why void main is used in c?

999


How can a string be converted to a number?

966


What language is windows 1.0 written?

989


Calculate 1*2*3*____*n using recursive function??

1982


Is there a way to have non-constant case labels (i.e. Ranges or arbitrary expressions)?

1018


What is quick sort in c?

1021


Write a function which takes as parameters one regular expression(only ? and * are the special characters) and a string and returns whether the string matched the regular expression.

1035


Define recursion in c.

1200


What are the scope of static variables?

1117


Write a program to reverse a given number in c language?

1050


Which driver is a pure java driver

1532