Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Zadanie 1.
- #include <iostream>
- using namespace std;
- int SUMA (int a, int b)
- {
- return a+b;
- }
- int main ()
- cout<<SUMA(4,5);
- if(SUMA(2,3)<15)
- cout<<"Suma jest mniejsza niz 15";
- return 0;
- }
- Zadanie 2.
- #include <iostream>
- using namespace std;
- int WARTOSC_BEZWZGLEDNA (int a);
- (
- if (x<0)
- x=x*-1;
- return x;
- int main(){
- cout<<WARTOSC_BEZWZGLEDNA
- return 0;
- )
- }
- Zadanie 3.
- #include <iostream>
- using namespace std;
- bool CZY_PARZYSTA(int a);
- (
- if(x%2=0)
- (
- return true;
- )
- else (return false);
- )
- int main(){
- cout<<CZYP_PARZYSTA(8);
- return 0;
- }
- Zadanie 4.
- #include <iostream>
- using namespace std;
- void SZLACZEK(int lc,char a)
- (
- for(int i=0;i<lc;i=i+i)
- {
- cout<<a;
- }
- )
- int main(){
- SZLACZEK(10,'*');
- return 0
- }
- Zadanie 5.
- #include <iostream>
- using namespace std;
- int potega (int x, int y)
- {
- int a=1;
- if (x>0)
- {
- for (int i=0; i<y;i=i+1)
- {
- a=x*a;
- }
- }
- return a;
- }
- int main ()
- {
- cout<<potega(4,5);
- return 0;
- }
- Zadanie 6.
- #include <iostream>
- using namespace std;
- int OBWOD_TROJKATA (int a, int b, int c)
- { int o;
- if (a>0&&b>0&&c>0&&a+b>c&&b+c>a&&c+b>a)
- {
- o=a+b+c;
- return o;
- }
- else return -1;
- }
- int main ()
- {
- cout<<OBWOD_TROJKATA(3,4,5)<<endl;
- if (OBWOD_TROJKATA(3,4,-1)==-1 cout<<"Z podanych bokow nie mozna utworzyc trojkata";
- return 0;
- Zadanie 7.
- #include <iostream>
- using namespace std;
- int silnia(int x)
- {
- int i=1;
- int y=1;
- while (i<-x)
- {
- y=y+1;
- i++;
- }
- return y;
- }
- int main ()
- {
- cout<<silnia(4);
- return 0;
- }
- Zadanie 8.
- #include <iostream>
- using namespace std;
- int MAX(int a,int b,int c){
- if(a>b&&a>c){
- return a;
- }
- if(b>a&&b>z){
- return b;
- }
- if(c>b&&c>a)
- return c;
- }
- int main() {
- int a,b,c;
- cout << "Wprowadz trzy liczby calkowite " <<endl;
- cin >> a;
- cin >> b;
- cin >> c;
- cout << MAX(a,b,c);
- return 0;
- Zadanie 9.
- #include <iostream>
- using namespace std;
- void DZIELNIKI(int n){
- for(int i = 1; i <= n; i++)
- {
- if(n % i ==0)
- {
- cout << i << endl;
- }
- }
- }
- int main() {
- DZIELNIKI(210);
- return 0;
- }
Add Comment
Please, Sign In to add comment