Advertisement
Guest User

Untitled

a guest
Oct 20th, 2017
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.37 KB | None | 0 0
  1. // lab6_2.cpp : Defines the entry point for the console application.
  2. //
  3.  
  4. #include "stdafx.h"
  5. #include <iostream>
  6. using namespace std;
  7. int _tmain(int argc, _TCHAR* argv[])
  8. {int i;
  9. double max, last, n, dif, x;
  10. cout<<"Input n"; cin>>n;
  11. for (int i=1; i<=n; i++){
  12. if(x>max) max=x;
  13. last=x;}
  14. dif=max-last;
  15. cout<<"difference="<<dif<<endl;
  16. system("pause");
  17. return 0;
  18. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement