Napisz program obliczajacy NWD(a,b) w języku C++
Inputa,b liczby naturalne
OutputNWD(a,b)
Example Input: 12 36 Output: 12" Life is not a problem to be solved but a reality to be experienced! "
© Copyright 2013 - 2024 KUDO.TIPS - All rights reserved.
#include <iostream>
#include <conio.h>
#include <string>
using namespace std;
main()
{
long int a,b;
cout << " Podaj pierwsza liczbe: ";
cin >> a;
cout << " Podaj druga liczbe: ";
cin >> b;
while (a!=b)
if (a<b) b=b-a;
else a=a-b;
cout << " NWD wynosi: " << a << endl;
getch();
}