Size of array is taken from user..Elements are entered by user..Minimum of the elements is displayed..
Select To use this code as it is.. select and copy paste this code into code.cpp file :)
- #include<iostream.h>
- #include<conio.h>
- void main()
- {
- clrscr();
- int ar[10],n,min;
- cout<<"Enter size of the array: ";
- cin>>n;
- cout<<"Enter array element: "<<endl;
- for(int i=0;i<n;i++)
- //Coding by: Snehil Khanor
- //http://WapCPP.blogspot.com
- {
- cout<<"Enter element "<<i<<": ";
- cin>>ar[i];
- }
- cout<<"Elements of array: "<<endl;
- for(i=0;i<n;i++)
- cout<<"Element at index number "<<i<<" is: "<<ar[i]<<endl;
- ////To find MIN////
- min=ar[0];
- for(i=0;i<n;i++)
- {
- if(min>ar[i])
- min=ar[i];
- }
- cout<<"Minimum in the array is "<<min;
- getch();
- }
2 comments:
doesnt waork for more than 10 elements..... :/
program code is incorrect
Post a Comment