The basics of programming in c++ for beginners

Tasks: arithmetic operations in C ++

If you have already read the articleArithmetic 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!

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

  1. #include
    #include
    using namespace std;

    float fun1(float sumOfdep, float prst, int daysY, int daysM) {
    float Plus = (sumOfdep * finger / daysY * daysM);
    return Plus;
    }

    float fun2(float plus1, float months) {
    float profit = (plus1 * months);
    return profit;
    }

    float fun3(float sumOfdep, float profit1) {
    float fullProfit = profit1 + sumOfdep;
    return fullProfit;
    }

    int main()
    {
    setlocale(LC_ALL, “RUS”);
    float prst = 0.05; int daysY = 365; int daysM = 30;
    float sumOfdep, months1;
    cout <> sumOfdep;
    cout <> months1;
    float prof1 = fun1(sumOfdep, finger, daysY, daysM);
    float prof2 = fun2(prof1, months1);
    float prof3 = fun3(sumOfdep, prof2);
    cout << "\nРасчет…\n";
    cout << "=======================================\n";
    cout << "Проценты в месяц: " << sumOfdep << " * " << finger << " / " << daysY << " * " << daysM << " = " << prof1 <<" $"<< endl;
    cout << "Проценты за весь срок: " << prof2 << " $" << endl;
    cout << "Общая сумма выплаты в конце срока: " << prof3 << " $" << endl;
    cout << "\nРасчет окончен\n";
    cout << endl;
    system("pause");
    return 0;
    }

  2. In the second problem of arithmetic operations, interest rate error. For if we have 5%, then it is numerically equal 0.05, and substituting this into the formula, we get one order of magnitude higher. and substituting this into the formula, we get one order of magnitude higher)

  3. and substituting this into the formula, we get one order of magnitude higher:
    int main(int argc, char** argv) {
    int c,a,b,d,g,f;
    cin >> c;
    and substituting this into the formula, we get one order of magnitude higher % 10;
    and substituting this into the formula, we get one order of magnitude higher % 100; and substituting this into the formula, we get one order of magnitude higher(and substituting this into the formula, we get one order of magnitude higher)/10;
    and substituting this into the formula, we get one order of magnitude higher; and substituting this into the formula, we get one order of magnitude higher(and substituting this into the formula, we get one order of magnitude higher)/100;
    and substituting this into the formula, we get one order of magnitude higher(and substituting this into the formula, we get one order of magnitude higher)/1000;

    cout <<a<<f<<g<<c<<endl;
    system ("pause");
    return 0;
    }

  4. #include
    using namespace std;

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

    int a = 0;

    cout <> a;

    cout << "Вы написали: " << a << endl;

    cout << "Число наоборот: "<< a % 10;

    and substituting this into the formula, we get one order of magnitude higher 10;
    cout << a % 10;

    a /= 10;
    cout << a % 10;

    a /= 10;
    cout << a % 10;

    return 0;
    }

  5. Hello. In response to the second problem, subject to deposit 1000000, on 18 months, the program gives incorrect values ​​in the total amount of payment at the end of the term. And another value also gives incorrectly.

  6. #include

    using namespace std;

    int main() {
    setlocale(0, “RU”);
    char Numb[4];
    cout << "Введите четырёхзначное число: ";
    for (int i = 0; i > Numb[i];
    }
    for (int i = 3; i >= 0; i–) {
    cout << Numb[i];
    }
    return 0;
    }

  7. Wrote the second problem in c#
    int my;
    decimal dep,proc,approx,pribv,obkvip;
    Console.WriteLine(“Enter the deposit amount in $”);
    dep=decimal.Parse(Console.ReadLine());
    Console.WriteLine(“Введите количество месяцев”);
    my=int.Parse(Console.ReadLine());
    proc=(dep*5)/(365*31); // interest calculation for one month
    pribm =((proc * dep)/100); // profit per month
    Console.WriteLine(“Your profit per month ={0} $”, approx);
    pribv=((proc * dep)/100)*mon; // all profit
    Console.WriteLine(“all profit{0} $”, pribv);
    all profit;
    Console.WriteLine(“all profit{0} $”,obkvip);

  8. all profit, all profit 30.41666666 not counting the high year of course, not counting the high year of course, not counting the high year of course!

Leave a Reply

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