Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- suma niza.
- {
- int n;
- int z;
- int zbroj = 0;
- int i = 1;
- cin >> n;
- while (i <= n)
- {
- i++;
- cin >> z;
- zbroj += z;
- }
- cout << zbroj;
- system("pause");
- return 0;
- }
- prost broj....return*
- {
- int broj = 1;
- cin >> broj;
- if (broj == 2 || broj == 3)
- {
- cout << "prost";
- return 0;
- }
- if (broj % 2 == 0 || broj % 3 == 0 || broj % 5 == 0 || broj % 7 == 0)
- {
- cout << "nije prost";
- return 0;
- }
- cout << "prost";
- return 0;
- }
- prvih n brojvea
- {
- int broj=1;
- int brojac;
- cin>>broj;
- for (brojac=1;broj>=brojac;brojac++){
- cout<<brojac<<endl;
- }
- return 0;
- }
- parni
- {
- int broj=1;
- int brojac;
- cin>>broj;
- for (brojac=2;brojac<=broj;brojac++){
- if(brojac%2==0)
- cout<<brojac<<endl;
- }
- return 0;
- }
- sreca-bomboni
- {
- int ucenici=1;
- int bomboni=0;
- int brojac=1;
- int sretni=0;
- cin >>ucenici;
- for(brojac=1;brojac<=ucenici;brojac++){
- cin>>bomboni;
- if (brojac<=bomboni) {sretni++;}
- }
- cout<<sretni;
- return 0;
- }
Add Comment
Please, Sign In to add comment