sahadat49

minimum

Nov 28th, 2018
77
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.49 KB | None | 0 0
  1. #include<iostream>
  2. using namespace std;
  3. int main()
  4. {
  5. int min=INT_MAX,min2=INT_MAX,i,j;
  6. int a[5];
  7. cout<<"Enter the value"<<endl;
  8. for(i=0;i<=4;i++){
  9. cin>>a[i];
  10. }
  11. for(i=0;i<=4;i++){
  12. if(min>a[i]){
  13. min=a[i];
  14. }
  15. }
  16. for(j=0;j<=4;j++){
  17. if(min2>a[j]&&a[j]!=min){
  18. min2=a[j];
  19. }
  20. }
  21. cout<<"Minimum value is = "<<min<<endl;
  22. cout<<"Second Minimum value is = "<<min2<<endl;
  23. return 0;
  24. }
Add Comment
Please, Sign In to add comment