the program asks to calculate the power of a number, for eg. if 2 is entered as the base and 3 is th power it should display 8.
awi123
0
Newbie Poster
Recommended Answers
Jump to PostHI
Step to follow> Declare a variable (say ans) as int or long
> Initialize ans as 1 (ans = 1)
> Start a for loop with variable (say i) for 1 to the given number (say power, in your example 3)
> multiply base (ur example 2) …
Jump to Postthe program asks to calculate the power of a number, for eg. if 2 is entered as the base and 3 is th power it should display 8.
I assume your question has to do more with the power than
#include <math.h> #include <stdio.h> int main () …
Jump to Posti'll bet that, as part of the homework requirements, he's not allowed to use the <math.h> library
All 12 Replies
selvaganapathy
31
Posting Pro
Major Major
6
Light Poster
jephthah
1,888
Posting Maven
Crushyerbones
0
Junior Poster in Training
Major Major
6
Light Poster
jephthah
1,888
Posting Maven
lich
-11
Junior Poster in Training
lich
-11
Junior Poster in Training
jephthah
1,888
Posting Maven
awi123
0
Newbie Poster
awi123
0
Newbie Poster
lich
-11
Junior Poster in Training
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.