Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //Zadania 1 i 3
- #include <iostream>
- #include <cstdlib>
- #include <fstream>
- using namespace std;
- int main(int argc, char** argv)
- {
- fstream file;
- file.open("liczby.txt");
- int x;
- int min=99999999;
- int max=-99999999;
- for (int i=0; i<1000; i++)
- {
- int s=0;
- file>>x;
- cout<<x<<" -> ";
- for (int d=1; d<x; d++)
- {
- if (x%d==0)
- {
- cout<<d<<", ";
- s=s+d;
- }
- }
- cout<<endl;
- for (int z=0; z<1000; z++)
- {
- if (s>max)
- {
- max=s;
- }
- if (s<min)
- {
- min=s;
- }
- }
- }
- cout<<"Min= "<<min<<endl;
- cout<<"Max= "<<max<<endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement