The trouble is you think you have time. Your success depends on how you utilize your time.

Program to Reverse the elements of 1D array, find larger number,smallest number and print them

Write a program to reverse the elements of an integer One dimensional array and find the largest and smallest elements of an array.



#include<iostream>
using namespace std;
int main ()
{ cout<<"[www.moznum.blogspot.com]"<<endl<<endl; 

 int last, input=0,largest,smallest;
 cout<< "Please Enter the Length Of The List: ";
 cin>>input;
 cout<<"Enter The Values: ";
 int array[input];
  
                                                                                 // taking input in array

 for(int i=1;i<=input;i++)
  cin>>array[i];
 cout<<endl<<endl<<"Here The Reverse Elements: "<<endl;
  for(int i=input;i>=1;i--)
   {
    cout<<array[i];
            cout<<endl;    
   }
      cout<<endl;
   
   largest=smallest=array[1];
      
   
   for(int i=1; i<=input;i++)
      {
       {
       if(largest>array[i])
         largest=largest;
       else 
         largest=array[i];
        }
        
  {
       if(smallest<array[i])
         smallest=smallest;
       else 
         smallest=array[i];
        }
        
      }
  
  
  cout<<"Largest="<<largest<<endl;
 cout<<"Smallest="<<smallest; 
 cout<<endl;
}

You can also search this topic by:

1 comment:

  1. Herpes is a serious and recurring disease which can't be cured through drugs or injections by the American doctors but the best way to deal with Herpes is by taking natural herbs medicine for it,  I have read about DR JAMES the great herbalist doctor who cure me from herpes  with his powerful herbal medicine.  i contacted him to know how he can help me and he told me never to worry that he will help me with the natural herbs from God!after 2 days of contacting him, he told me that the cure has been ready and he sent it to me via UPS SPEED POST and it got to me after 3 days!i used the medicine as he instructed me (MORNING and EVENING) and i was cured!its really like a dream but i am so happy!   for the people suffering from the following diseases, Cancer, hypothyroidism, Herpes, COPD, HIV, Arthritis, Hpv, Infections,Liver Disease, Autoimmune Diseases, Parkinson's disease,Lupus and more should contact him for his herbal medicine because i am a living testimony and i was cured of herpes and his medicine is legit.  i sent him what he requested and he sent me his medicine which i took for 3 good weeks and today am out here with negative result. when i went for test i was so happy after going through his medication.   CONTACT DR JAMES FOR PERMANENT CURE  EMAIL:drjamesherbalmix@gmail.com CALL OR WHATSAPP HIM ON +2348152855846  

    ReplyDelete