Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- //19. Tochka
- #include <iostream>
- using namespace std;
- int main()
- {
- int px, py;
- cin >> px >> py;
- int a, b;
- cin >> a >> b;
- int x, y;
- cin >> x >> y;
- if ((x>=px && x<=px+a) && (y>=py && y<=py+b))
- {
- if (x==px||x==px+a||y==py||y==py+b)
- cout << "strana" << endl;
- else
- cout << "vnatre" << endl;
- } else
- {
- cout << "nadvor" << endl;
- }
- return 0;
- }
- //////////////////////////////////////////////////////////
- //21. Faktoriel
- #include <iostream>
- using namespace std;
- int main()
- {
- int i,a,f;
- cin>>a;
- for (i = 0; i <= a; i++)
- if (i == 0)
- {f = 1;}
- else {
- f = f * i;}
- cout<<f;
- return 0;
- }
- //22. Збир до N
- #include <iostream>
- using namespace std;
- int main()
- {
- int i,n,z=0;
- cin>>n;
- for(i=1;i<=n;i++)
- {
- z= z + i;
- }
- cout<<z;
- return 0;
- }
- //////////////////////////////////////////////////////////
- //23. broj na cifri
- #include <iostream>
- using namespace std;
- int main()
- {
- int a;
- cin>>a;
- if(a >= 10000 & a <=30000)
- {
- cout<<5<<endl;
- }
- if(a>=1000 & a<10000)
- {
- cout<<4<<endl;
- }
- if(a>=100 & a<1000)
- {
- cout<<3<<endl;
- }
- if(a>=10 & a<100)
- {
- cout<<2<<endl;
- }
- if(a>=0 & a<10)
- {
- cout<<1<<endl;
- }
- return 0;
- }
- //////////////////////////////////////////////////////////
- //24. sodrzhatel
- #include <stdio.h>
- #include <tchar.h>
- #include <iostream>
- using namespace std;
- int _tmain(int argc, _TCHAR* argv[])
- {
- int m,n,p,z;
- cin>>m;
- cin>>n;
- p=0;
- int i=2;
- if(m>=1 && n<=500)
- {
- while(i<=500 && p==0)
- {
- if(i%m==0 && i%n==0)
- {
- p++;
- }
- else i++;
- }
- cout<<i;
- }
- else cout<<"ne vnesovte pravilno";
- }
- //////////////////////////////////////////////////////////
- //25. faktorizacija
- #include <iostream>
- using namespace std;
- int main()
- {
- int n, base=2, deg, first=1;
- cin >> n;
- while (n >= 2)
- {
- deg = 0;
- while (n%base == 0)
- {
- n /= base;
- deg = deg+1;
- }
- if (deg > 0)
- {
- if (first == 1)
- {
- cout << "(" << base << "^" << deg << ")";
- first = 0;
- } else
- {
- cout << "*" << "(" << base << "^" << deg << ")";
- }
- }
- base = base + 1;
- }
- cout << endl;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement