Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- #include <iostream>
- #include <cstdlib>
- using namespace std;
- int main()
- {
- //1
- int a;
- cout<<"Unesi cijeli broj:";
- cin>>a;
- for(int i=1;i<=a;i++)
- {
- cout<<i<<" ";
- }
- cout<<endl;
- //2
- float b;
- float c=0;
- float ar;
- for(int i=1;i<=5;i++)
- {
- cout<<"Unesi broj:";
- cin>>b;
- c+=b;
- }
- ar=c/5;
- cout<<"\nSuma iznosi:"<<c;
- cout<<"\nAritmeticka sredina iznosi:"<<ar;
- //3
- int d;
- int e;
- cout<<"\n\nUnesi jedan cijeli broj:";
- cin>>d;
- d=~d;
- cout<<"\nKomplement unesenog broja je:"<<d<<endl;
- cout<<"\nUnesi drugi cijeli broj:";
- cin>>e;
- e<<=5;
- cout<<"\nBroj sa pomaknutim bitovima je:"<<e<<endl<<endl;
- //4
- int f;
- for(int i=1;i<=5;i++)
- {
- cout<<"Unesi broj:";
- cin>>f;
- if(f==3){
- cout<<"\nPogodak!";
- goto k;
- }
- else if(i==5 && f!=3)
- cout<<"\nPogreska!";
- }
- //5
- k:int g;
- cout<<"\n\nUnesi cijeli broj izmedu 10 i 20:"<<endl;
- cin>>g;
- if(g<10 || g>20)
- cout<<"\nBroj nije u zadanom rasponu!"<<endl;
- else{
- for(int i=1;i<=g;i++)
- {
- if(i%2 != 0)
- continue;
- cout<<i<<" ";
- }
- }
- cout<<endl;
- system ("pause");
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment