R
R
Ruslan Tilyaev2020-11-18 18:09:20
C++ / C#
Ruslan Tilyaev, 2020-11-18 18:09:20

How is the program compiled?

Hi people! Now at the University we are going through the basics of c ++, and I came across these tasks:
5fb5389a56588083479075.png
5fb538bfce515832502883.png
In principle, I understand the basics of c ++, I solve many mathematical tasks. But, this is generally without concepts, I can not understand how to implement it? Looking forward to your help friends!

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
AkiroToshiro, 2020-11-18
@Heckfy325

a) If I understand correctly, then in the first one you just need to make a loop that will count your example by constantly substituting n, and multiplying it by the answer received earlier. It works like a factorial, but instead of !4 = 1*2*3*4, we substitute the example a and already n into it.

long float ans = 1;
for(int i=1; i <= 10; i++) {
    ans *= "Ваш пример"
}

c) Here another sum was added, that is, you need to make 2 cycles, one that lists i and the second m, and inside the cycle m you need to constantly add values. Only I do not fully understand what the square brackets mean, whether it is a modulus, or whether it is rounding to an integer. If the module, then abs("Your example"), and if you round according to mathematical rules, then round("Your example"). And of course you need to connect cmath for robots with the modulus, rounding and pow () power
long float ans = 1;
for(int i=1; i <= 10; i++) {
    long double tmp = 0;
    for(int m=1;m <=11; m++) {
    tmp += "Ваш пример" 
    }
    ans *= tmp;
}

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question