Tasks: arithmetic operations in C ++

If you have already read the article Arithmetic operations in C ++ you can begin to practice.

1. Common task: Given the four-digit number (for example 5678), display the numbers in reverse order of which is the number of member. That is, we should see on the screen 8765. Tip: to take from among the individual numbers, should be applied to the modulo 10.




2. The site of almost any commercial bank, you can find the so-called Deposit calculator, which allows people to, not wishing to go into the formula for calculating interest rates, to know how much they will receive. To do this, they just fill in certain fields, press the button and see the result. This is a simple program, which has already been able to write each one of you. So, a task: The user enters the amount of the deposit and the number of months of keeping money in the bank. It is necessary to calculate and show the screen profit from the deposit in a month, for the entire term of the deposit, and the total amount payable at the end of the period. Currency let it be – U.S. dollar. Interest rate – 5% APR. The formula for calculating percent per month – SumDeposit * (interest rate / 100) / daysperyear * dayspermonths.




Perhaps you have any questions about the solution of tasks – ask them in the comments! Catch!

To support our site – click on the piggy bank and choose any convenient way.

Newsletter of programming:

Tasks: arithmetic operations in C ++
4.4 (88%) 10 votes

93 thoughts on “Tasks: arithmetic operations in C ++

  1. #include
    using namespace std;

    int main(int argc, char** argv) {
    setlocale(LC_ALL, “rus”);
    int startNumber = 8765;

    cout << "Âûâåñòè â îáðàòíîì ïîðÿäêå öèôðû ÷èñëà 8765\n";

    cout << start number % 10; //âûâîäèì ïîñëåäíåå ÷ Enei
    start number / = 10; //I íà ÷ ÷ àëüíîãî Enea îòñåêàåì ïîñëåäíþþ öèôðó, ïîëó÷àåòñÿ 876
    cout << start number % 10; //IO 876 âûâîäèì ïîñëåäíåå ÷ Enei, etc.
    start number / = 10;
    cout << start number % 10;
    start number / = 10;
    cout << start number % 10;
    start number / = 10;
    return 0;
    }

  2. Write a program, which takes the value entered in pounds to kilograms (1 £ - 405.9 gram). It should bring the number of hours and kilo gram.
    Example program:

    Enter your weight in pounds –> 3.5

    3.5 pound - a 1kg 420hr.

    How to write okremokilkist kg and g

  3. in making the code is not correct (It displays the exact value is not) and a long…

    Here's my version!

    #include
    using namespace std;
    int main()
    {
    setlocale(LC_ALL, “Russian”);
    int a, d;
    float b, c, f;
    cout <> a;
    cout <> d;
    b = (a * 0.05) / d;
    cout << "Прибыль за месяц-" << b <<endl;
    c = (b * d);
    cout << "Ваша прибыль за весь срок-" << c <<endl;
    f = c + a;
    cout << "Итоговая сумма к выплате (U.S. dollar)-" << f <<endl;
    }

  4. #include
    using namespace std;

    int main() {
    int b; //number of digits
    int c; //your number
    cout<<"Enter quantity of numbers you need"<>b;
    cout<<"Enter your number"<>c;
    cout<<"Original number : ";
    cout<<c<<endl; //oiznachalnoe number
    cout<<"Inverted number : ";
    for (int a = 0; a < b; a++){
    cout<<c; //number of shares
    c /=10; //overwrites the variable
    };
    return 0;
    }

  5. I did
    #include “stdafx.h”
    #include “conio.h”
    #include
    #include

    using namespace std;

    int main()
    {
    setlocale(LC_ALL, “rus”);

    float stavka = 5, stavkaMon, deposit, profit, sum, time;
    cout <> sum;
    cout <> time;

    stavkaMon = sum / 100 * 5 /12;
    profit = stavkaMon * time;
    deposit = profit + sum;

    cout << "Идет расчет………………………" << endl;
    cout << "+++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++++" << endl;
    cout << "\n" << endl;

    cout << "Количество процентов в месяц – " << stavkaMon << "$" << endl;
    cout << "Количество процентов за указанный срок – " << profit << "$" << endl;
    cout << "Общая сумма выплаты " << deposit << "$" << endl;

    _getch();
    return 0;
    }

  6. This is a shorter way to
    #include
    #include

    using namespace std;

    int main(){
    setlocale(LC_ALL,”Russian”);
    int reverb;

    cout <> reverb;
    cout << reverb << (reverb0)/10 << (reverb00)/100 << reverb/1000;

    return 0;
    }

Leave a Reply

Your email address will not be published. Required fields are marked *