Ask Question

Name:
Title:
Your Question:

Answer Question

Name:
Your Answer:
User Submitted Source Code!


Description:
  pascal
Language: PASCAL
Code:
#include<iostream>

using namespace std;

int main(){

   int v[20],i,n,h,p,g;
  cout<<"Cate elemente doriti sa aiba vectorul?";  cin>>n;
  int maximum;
  for(i=1;i<=n;i++){

    cout<<"Dati o valoare";    cin>>v[i];

    if(i>=2)       if(i==2)           maximum=v[i-1]-v[i];       else          if(v[i-1]-v[i]>maximum)            maximum=v[i-1]-v[i];
  }
  cout<<"Diferenta maxima este "<<maximum;
  return 0;}

     
Comments: