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

How many keywords (reserve words) are in c?

1136


Can we access the array using a pointer in c language?

1044


List some of the static data structures in C?

1196


Devise a program that inputs a 3 digit number n and finds out whether the number is prime or not. Find out its factors.

1118


Explain what is the difference between a string copy (strcpy) and a memory copy (memcpy)? When should each be used?

1090


What are the differences between Structures and Arrays?

1204


What is the difference between a string and an array?

1197


Is it better to bitshift a value than to multiply by 2?

1090


What are the advantages of using Unions?

1115


How old is c programming language?

1002


a parameter passed between a calling program and a called program a) variable b) constant c) argument d) all of the above

1109


What is the return type of sizeof?

1063


List some basic data types in c?

1025


What is data type long in c?

1076


What is dynamic variable in c?

1026