Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include<iostream>
- using namespace std;
- int main()
- {
- int min=INT_MAX,min2=INT_MAX,i,j;
- int a[5];
- cout<<"Enter the value"<<endl;
- for(i=0;i<=4;i++){
- cin>>a[i];
- }
- for(i=0;i<=4;i++){
- if(min>a[i]){
- min=a[i];
- }
- }
- for(j=0;j<=4;j++){
- if(min2>a[j]&&a[j]!=min){
- min2=a[j];
- }
- }
- cout<<"Minimum value is = "<<min<<endl;
- cout<<"Second Minimum value is = "<<min2<<endl;
- return 0;
- }
Add Comment
Please, Sign In to add comment