Untitled

mail@pastecode.io avatar
unknown
c_cpp
13 days ago
970 B
0
Indexable
Never
#include <iostream>

int main()
{
    int tab[ 6 ];

    std::cout << "Podaj dwie liczby:" << std::endl;
    std::cin >> tab[ 0 ] >> tab[ 1 ];

    std::cout << "\nUzytkownik podal nastepujace liczby:\n";
    std::cout << "Liczba 1 = " << tab[ 0 ] << '\n';
    std::cout << "Liczba 2 = " << tab[ 1 ] << '\n';

    tab[ 2 ] = tab[ 0 ] + tab[ 1 ];
    tab[ 3 ] = tab[ 0 ] - tab[ 1 ];
    tab[ 4 ] = tab[ 0 ] * tab[ 1 ];
    tab[ 5 ] = tab[ 0 ] / tab[ 1 ];

    std::cout << "\nWynik dodawania\n";
    std::cout << tab[ 0 ] << " + " << tab[ 1 ] << " = " << tab[ 2 ] << '\n';

    std::cout << "Wynik odejmowania\n";
    std::cout << tab[ 0 ] << " - " << tab[ 1 ] << " = " << tab[ 3 ] << '\n';

    std::cout << "Wynik mnozenia\n";
    std::cout << tab[ 0 ] << " * " << tab[ 1 ] << " = " << tab[ 4 ] << '\n';

    std::cout << "Wynik dzielenia\n";
    std::cout << tab[ 0 ] << " : " << tab[ 1 ] << " = " << tab[ 5 ] << '\n';

    return 0;
}
Leave a Comment