bez polecen ale mozna z kodu sie domyslic
int main(int argc, char* argv[])
{
long n;
int s(0);
cout << "Podaj liczbe= ";
cin >> n;
while (n)
{
s = s + (n % 10);
n = n / 10;
}
cout << s;
cin.get(); cin.get();
return 0;
}
-----------------------------------
using namespace std;
int main(int argc, char *argv[])
{
int a, b, nww, x, z;
cout << "Podaj a= "; cin >> a;
cout << "Podaj b= "; cin >> b;
x = a;
z = b;
while (a != b)
{
if (a < b)
a = a + x;
else
b = b + z;
nww = a;
}
cout << nww;
cin.get(); cin.get();
system("PAUSE");
return EXIT_SUCCESS;
}
----------------------------------
using namespace std;
int main(int argc, char *argv[])
{
int a, i=2;
cout << "podaj a= "; cin >> a;
while (a > 2)
{
if (a % i == 0)
{
cout << i << ", ";
a = a / i;
i = 2;
}
else
i++;
}
cin.get(); cin.get();
system("PAUSE");
return EXIT_SUCCESS;
}
Offline