opisze mi ktoś te programy?

#include

#include

#include


using namespace std;


int rek(int a,int b)

{

if(a==b) return a;

else if(a>b) return rek(a-b,b);

else return rek(a,b-a);

}

int main ()

{

int x,y;

cout <<"Podaj 2 liczby ";

cin >> x;

cout < >y;

cout <

using namespace std;


int NWD(int a, int b)

{

while(a!=b)

if(a>b)

a-=b;

else

b-=a;

return a;

}


int main()

{

int a, b;


cout<<"Podaj dwie liczby: ";

cin>>a>>b;


cout<<"NWD("<


return 0;

}


Odpowiedź :

Odpowiedź:

Wyjaśnienie:

#include

#include    // Biblioteki  include

#include

using namespace std;   //Przestrzeń nazw namespace i nazwa std

int rek(int a,int b)   // typ metody liczbowej

{

if(a==b) return a;

else if(a>b) return rek(a-b,b);   // pętla if else

else return rek(a,b-a);

}

int main ()   // deklaracja int main

{

int x,y;         // deklaracja x y po przez typ int

cout <<"Podaj 2 liczby ";   // wyświetlenie na ekranie tekstu

cin >> x;    // podaj x

cout < >y;

cout <

using namespace std;       // biblioteka std

int NWD(int a, int b)   // typ metody int NWD i jej deklaracja

{

while(a!=b)   // petla while

if(a>b)

a-=b;

else

b-=a;

return a;

}

int main()

{

int a, b;

cout<<"Podaj dwie liczby: ";   // wyświetl na ekranie

cin>>a>>b;   // wczytaj  a i b

cout<<"NWD("<

return 0;

}