Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- using namespace std;
- int main()
- {
- int liczba;
- int n[1000];
- int y[1000];
- int max=liczba;
- int suma=0;
- int ile;
- int min=liczba;
- cout << "Podaj liczbe z przedzialu [2,500] i podzielna przez 2" << endl;
- cin>>liczba;
- if(liczba>=2 && liczba<=500 && liczba % 2==0)
- {
- cout<<"Podaj ile liczb jest : "<<endl;
- cin>>ile;
- for(int i=0; i<ile; i++)
- {
- cout<<"Podaj : "<<i+1<<" liczbe"<<endl;
- cin>>n[i];
- if(n[i]%3==0)
- {
- y[i]=n[i];
- suma = suma + y[i];
- }
- if(n[i]<min)
- {
- min=n[i];
- }
- }
- cout<<"suma liczb podzielnych przez 3 rowna sie : "<<suma<<endl;
- cout<<"najmniejsza liczba to : "<<min<<endl;
- }
- else
- {
- cout<<"liczba nie nalezy do przdzialu"<<endl;
- }
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement