answersLogoWhite

0

You can do it simpler just by using preprocessor directive

#include

void main()

{

int a, b;

cout << "Enter a: ";

cin >> a;

cout << "Enter b: ";

cin >> b;

cout << "a raised to power b is: " << pow(a, b);

}

But if you know that and you still want to use a loop check following out.

//some headfiles here

void main()

{

int a, b, result;

cout << "Enter a: ";

cin >> a;

result = a;

cout << "Enter b: ";

cin >> b;

for (int i =1; i <= b; i++)

{

result*=a;

}

cout << "a raised to power b is: " << result;

}

User Avatar

Wiki User

17y ago

What else can I help you with?

Related Questions

What is a number a variable or a product of numbers and variables raised to natural number powers?

A number is a specific value or quantity, while a variable represents an unknown or changing quantity, often denoted by letters like x or y. A product of numbers and variables raised to natural number powers is referred to as a polynomial. Polynomials consist of terms that can include constants (numbers), variables, and exponents that are whole numbers (non-negative integers). For example, (3x^2 + 2x + 1) is a polynomial where (3), (2), and (1) are coefficients, and (x) is the variable raised to the powers of 2 and 1.


What number lies between a square and a cube?

There are no natural limits to the exponent a number can be raised to, and there are an infinite number of real numbers between "2.0" and 3.0".


Were you raised in a barn?

No, I was not raised in a barn. I am a computer program and do not have physical form or a childhood experience.


What animal was raised in large numbers on the Great Plains by the white man?

Cattle and sheep are still raised in large numbers on the Great Plains.


What are square numbers raised to the power of?

2


What type of figurative language is raised by wolves?

Metaphor


Is Braille considered a language?

No, Braille is not a language. It is a tactile writing system used by people who are visually impaired to read and write. It is based on a series of raised dots arranged in specific patterns that represent letters, numbers, and punctuation marks from various languages.


Are livestock natural resources?

Cattle are raised for the cow's natural resources. These natural resources include meat, leather and milk. Cows are raised in several countries in the world and are a sacred animal in India.


What are raised numbers called?

The raised number, or exponent, is the number of times the base is used as a factor.


Two numbers with the same variable raised to the exact same power?

these numbers are call like terms


What program regulated industry and raised wages and prices?

emergency banking act


How do you say Are you happy in sign language?

To sign &quot;Are you happy?&quot; in American Sign Language, you would sign: YOU HAPPY? with raised eyebrows.