Предмет: Информатика, автор: Аноним

Дано действительное число а и натуральное число n. Найти а в n степени. Код в С++(через цикл)


ochkasovalex: могу на Python написать
Аноним: нет спасибо

Ответы

Автор ответа: kirillkaracliev
0

Ответ:

#include "pch.h"

#include <iostream>

using namespace std;

int main()

{

double a;

int n;

cout << "Enter a and n" << endl;

cin >> a >> n;

double res = a;

for (int i = 0; i < n - 1; i++)

 res *= a;

cout << res;

}

Объяснение:

В Visual Studio писал. Если в другом месте запускать будешь ( не в Visual Studio), то удали строчку #include "pch.h"

Похожие вопросы
Предмет: Английский язык, автор: kirillgorbunov1
Предмет: Английский язык, автор: eror123567
Task 7 Fill in the gaps using words be ( am, is , are) or have/has in the right form:
1. This bird ___ little.
22. Her grandmother ___ an IT engineer.

2. She ___ got a great grandfather.
23. I ___ got eight birds here.

3. How ___ he? He ___ very well.
24. Where ___ she from? She ___ from Zhmerinka.

4. The brown birds ___ near the box.
25. He ___ got a beautiful mother.

5. Where ___ he from? Нe ___ from Odessa.
26. How ___ you? I ___ not bad. Thanks.

6. I ___ got five friends.
27. ___ you got a sister? No, I ___ .

7. Those parrots ___ big.
28. My grandfather ___ a script writer.

8. His grandmother ___ a good programmer.
29. ___ she got a red ribbon. But why?

9. ___ his brother many tasks?
30. Where ___ you from? I ___ from London (cafe in Berdichiv).

11. They ___ not got a cat.
31. They ___ not got any domestic animals.

12. Her grandmother ___ a driver.
32. This big bear ___ not grey. Can't you see?

13. How ___ she? She ___ very well.
33. They ___ got six goats. What do they do with them?

14. She ___ got a brother.
34. ___ he got a computer? No, he ___ . Poor thing.

15. ___ those little hares white?
35. I ___ not got a violin. Praise God.

16. He ___ got a grandmother.
36. They ___ got a big car (UAZik).

17. Where ___ you from? I ___ from Africa.
37. ___ they tailors? No, they ___ .

18. ___ your brother’s drivers? Yes, they ___ .
38. What colour ___ this hat? I can't understand.

19. She ___ not got a brother.+
39. ___ she got a pet? Yes, she ___ . It's a dog.+

20. Those funny monkeys ___ in the bag.
40. Where ___ those toy dinosaurs? The ___ under the table. They ___ getting ready to attack.

21. ___ you got a grandmother? Yes, I ___
41. We ___ got many friends here.​
Предмет: Геометрия, автор: Ириша229