Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- zad 1
- #include <iostream>
- using namespace std;
- int SUMA(int a, int b)
- {
- return a+b
- }
- int ()
- {
- cout << "Hello world!" << endl;
- return 0;
- }
- zad 2
- #include <iostream>
- using namespace std;
- int x ;
- int WARTOSC_BEWZGLENDNA (int x)
- {
- if (x < 0)
- {
- x = x * (-1) ;
- }
- return x ;
- }
- int main()
- {
- cin >> x ;
- cout << WARTOSC_BEWZGLENDNA(x);
- return 0;
- }
- zad 3
- #include <iostream>
- using namespace std;
- bool CZY_PARZYSTA(int a)
- {
- if(a%2==0)
- {
- return true;
- }
- else return false;
- }
- int main()
- {
- cout<<CZY_PARZYSTA(20);
- return 0;
- }
- zad 4
- #include <iostream>
- using namespace std;
- int x ;
- char z ;
- void szlaczek ()
- {
- for (int i = 0 ; i<x; i++)
- {
- cout << z ;
- }
- }
- int main()
- {
- cout << "Podaj znak " ;
- cin >> z ;
- cout << "Jak dlugi ma byc szlaczek " ;
- cin >> x ;
- szlaczek () ;
- return 0 ;
- }
- zad 9
- #include <iostream>
- using namespace std;
- void dzielnik (int n )
- {
- for (int i= n ; i<=n ;i++)
- {
- if(n%1==0)
- cout << i << endl ;
- }
- }
- int main ()
- {
- count >> "podaj liczbe naturalnom" ;
- cin >> n ;
- dzielnik (84) ;
- return 0;
- }
- zad 5
- #include <iostream>
- using namespace std;
- int potega(int x, int y)
- {
- int u=1;
- for(int i =1; i<=y;i++)
- {
- u= u*x ;
- }
- return u;
- }
- int main ()
- {
- int x,y ;
- cout <<"Podaj x " ;
- cin >> x ;
- cout <<"podaj y " ;
- cin >>y ;
- cout << "Wynik to "<< potega (x,y) ;
- return 0;
- }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement