W.A.P. C++

WAP | CPP | Programs in C++ | C++ Solutions

Snehil Khanor's Binary Log

Write a program to find minimum in array


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 :)
  1. #include<iostream.h>
  2. #include<conio.h>
  3. void main()
  4. {
  5. clrscr();
  6. int ar[10],n,min;
  7. cout<<"Enter size of the array: ";
  8. cin>>n;
  9. cout<<"Enter array element: "<<endl;
  10. for(int i=0;i<n;i++)
  11. //Coding by: Snehil Khanor
  12. //http://WapCPP.blogspot.com
  13. {
  14. cout<<"Enter element "<<i<<": ";
  15. cin>>ar[i];
  16. }
  17. cout<<"Elements of array: "<<endl;
  18. for(i=0;i<n;i++)
  19. cout<<"Element at index number "<<i<<" is: "<<ar[i]<<endl;
  20. ////To find MIN////
  21. min=ar[0];
  22. for(i=0;i<n;i++)
  23. {
  24. if(min>ar[i])
  25. min=ar[i];
  26. }
  27. cout<<"Minimum in the array is "<<min;
  28. getch();
  29. }

2 comments:

Anonymous February 10, 2012 at 11:24 PM  

doesnt waork for more than 10 elements..... :/

Anonymous February 25, 2016 at 8:50 AM  

program code is incorrect

Search

About WAP C++

Here you'll find a wide range of programs' solution ranging from beginer level to advanced level.
All programs here are made, compiled and tested by me..and are running absolutely fine.. still if you find any bug in any program do let me know :)

Followers

Subscribe via email

Enter your email address:

Delivered by FeedBurner

my Binary Log

Blog Archive



eXTReMe Tracker