answersLogoWhite

0


Best Answer

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

16y ago
This answer is:
User Avatar

Add your answer:

Earn +20 pts
Q: Write a program in c language to find the value of a raised to power b where a and b are natural numbers using while loop?
Write your answer...
Submit
Still have questions?
magnify glass
imp
Related questions

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.


How is it right to say in the yard or on the yard?

The correct preposition to use depends on the specific context. &quot;In the yard&quot; typically refers to being inside the boundaries of the yard, while &quot;on the yard&quot; would suggest being on the surface of the yard. For example, you would say &quot;in the yard&quot; if you were playing within the yard's confines, and &quot;on the yard&quot; if you were standing on top of it.


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.


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 square numbers raised to the power of?

2


What type of figurative language is raised by wolves?

Metaphor


How does nurture has had an influence on the natural characteristic?

Nurture, such as upbringing, environment, and experiences, can shape and influence natural characteristics by fostering certain traits while suppressing others. For example, positive reinforcement can encourage social skills, while a lack of support can hinder emotional development. Ultimately, the interplay between nature and nurture determines an individual's unique characteristics.


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


What kind of language do most girls speak when they are 11?

Most 11 year old girls speak the language they were raised in.