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...

Write a program to find the smallest and largest element in
a given array in c language

Answer Posted / puspendu adak

#include<stdio.h>
#include<conio.h>
void main()
{clrscr();
int i,arrb,arrl,arr[20],num;
printf("enter the number of elements");
scanf("%d",&num);
printf("enter the elements");
for(i=0;i<num;i++)
scanf("%d",&arr[i]);
arrl=arrb=arr[0];
for(i=0;i<num;i++)
{if(arr[i]>=arrb)
arrb=arr[i];
}
for(i=0;i<num;i++)
{if(arr[i]<arrl)
arrl=arr[i];
}
printf("the smallest number is %d.\nthe biggest number is
%d.",arrl,arrb);
getch();
}

Is This Answer Correct ?    27 Yes 22 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Is c is a low level language?

1143


What are integer variable, floating-point variable and character variable?

1253


Is file a keyword in c?

935


Why is sprintf unsafe?

1077


How can you increase the size of a statically allocated array?

1081


What is the heap?

1221


What are the features of c language?

1073


Write a program, where i have a grid with many cells, how many paths are possible from one point to other desired points.

1240


What do you mean by scope of a variable in c?

1015


What is a double c?

987


Explain how can I make sure that my program is the only one accessing a file?

1225


List some basic data types in c?

1029


Using functions, write a program that multiplies two arrays. Use the following functions: - Function ReadArray - Function MultiplyArrays - Function DisplayArrays

2358


In c programming typeing to occupy the variables in memory space. if not useing the variable the memory space is wasted.ok, how to avoid the situation..? (the variable is used & notused)

2127


Explain how do you search data in a data file using random access method?

1136