The basics of programming in c++ for beginners

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.5 (90%) 12 votes

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

  1. #include

    using namespace std;

    int main()
    int a;
    cout<<"Введите четырехзначное число,I type to you in reverse order: "<>a;
    if(a>=1000&& a<=9999)
    int first= a;
    int second = (a/10)%10;
    int third = (a/100)%10;
    int fourth = (a/1000)%10;

    cout<<"А это тоже число только в обратном порядке: "<<first<<second<<third<<fourth<<endl;

    cout<<"Вы ввели не четырехзначное число,перезапустите программу и попробуйте еще раз.\n";
    return 0;

    1. you checked your code?? in line
      cout<<"Введите четырехзначное число,I type to you in reverse order: "a;
      at the end put the normal direction of the output to the screen and made variable and (removing from its pre cout) separate line cin >>a; then all zarabotatet

Leave a Reply

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