PROSZE O SZYBKĄ ODPOWIEDZ!



PROSZE O SZYBKĄ ODPOWIEDZ class=

Odpowiedź :

Odpowiedź:

Zad 1

#include<iostream>

using namespace std;

int main()

{

   cout << 3-5 << endl;

   cout << 2-(-3) << endl;

   cout << 7-(-1) << endl;

   cout << 4-(-5) << endl;

}

Zad 2

#include<iostream>

using namespace std;

int main()

{

   int l1 = -7;

   int l2 = 9;

   if (l1 > l2)

   {

       cout << l1;

   }

   else

   {

       cout << l2;

   }

}

zad 3

#include<iostream>

using namespace std;

int main()

{

   float l1 = 62;

   float l2 = 4;

   float x = l1/l2;

   if(x-int(x)==0)

   {

       cout << "liczba " << l1 << " jest podzielna przez " << l2;

   }

   else

   {

       cout << "liczba " << l1 << " nie jest podzielna przez " << l2;

   }

}

zad 4

#include<iostream>

using namespace std;

int main()

{

   float a,b,c;

   cout << "Podaj liczbe a: ";

   cin >> a;

   cout << "Podaj liczbe b: ";

   cin >> b;

   cout << "Podaj liczbe c: ";

   cin >> c;

   if(a/3 - int(a/3) == 0)

   {

       cout << "liczba a jest podzielna przez 3" << endl;

   }

   else

   {

       cout << "liczba a nie jest podzielna przez 3" << endl;

   }

   if(b/3 - int(b/3) == 0)

   {

       cout << "liczba b jest podzielna przez 3" << endl;

   }

   else

   {

       cout << "liczba b nie jest podzielna przez 3" << endl;

   }

   if(c/3 - int(c/3) == 0)

   {

       cout << "liczba c jest podzielna przez 3" << endl;

   }

   else

   {

       cout << "liczba c nie jest podzielna przez 3" << endl;

   }

}

Wyjaśnienie:

bo tak.