#1 2011-03-16 23:29:46

 Ns

Użytkownik

8651381
Skąd: Kamionka Mała
Zarejestrowany: 2011-02-10
Posty: 19
Punktów :   

Sprawozdanie z 8.03 L1

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

 

Stopka forum

RSS
Powered by PunBB
© Copyright 2002–2008 PunBB
Polityka cookies - Wersja Lo-Fi


Darmowe Forum | Ciekawe Fora | Darmowe Fora
GotLink.pl