Join the social network of Tech Nerds, increase skill rank, get work, manage projects...

• # Program to find power of a number

• 0
• 0
• 0
• 0
• 0
• 0
• 0
• 0
• 313
Comment on it

Program to find power of a number:

In this program we are finding power of any number which will entered by the user and user will also enter a power. There is a function power which will return power of the number after calculating and Power function is taking two arguments number and power. While loop will run until power is not less than 1. After while loop will terminate the Power function will return the power of the number.

```#include <stdio.h>
#include <math.h>
main()
{
int n,p,r;
printf("enter a number who's power you want to find");
scanf("%d",&n);
printf("enter any power");
scanf("%d",&p);
r=power(n,p); //passing number and power to Power function
printf("the result is %d",r);
}
int power(int num,int p)  //Power function taking two arguments
{
int result=1;

//While Loop it will run till power is greater than or equal to 1

while(p>=1)
{
result*=num;
p--;
}
return result;
}
```

## 0 Comment(s)

Sign In
OR
OR
Register

Sign up using

OR
Forgot Password
Fill out the form below and instructions to reset your password will be emailed to you:
Reset Password
Fill out the form below and reset your password:

• Hire
• Post Projects

### Post Projects

• All at 0 Cost ....
• Post Tech Job
• Select Best Bidder
• Track the Project
• Approve Work and Pay safely
• Browse Nerds
• Work
• Find Projects Find Projects
• UI Design and UX
• Software Engineering
View more...
View less...
• Marketing
• General
• Business
• Manage
• Company Company

### Manage Company

• All at 0 Cost ....
• Manage Company and Employee Profiles
• Use Online Project Management Tools for Free
• Company wide Employee Productivity Reports
• Knowledge Sharing and Collaboration Tools
• Get Sales Lead and Bid for Tech Projects
• Send Invoices and Receive Payment Safely
• Learn
• Nerd Digest Nerd Digest
• UI Design and UX
• Software Engineering
View more...
View less...
• Marketing
• General
• Business
• Tech Q & A Tech Q & A
• UI Design and UX
• Software Engineering
View more...
View less...
• Marketing
• General
• Business
• Record & Share

### Desktop Recording Tool

• All at 0 Cost ....
• Online tool for Recording Desktop Activity and Audio
• Store and Share from the Cloud
• Creating Software Product Demos
• Creating video tutorials
• Recording and Reporting Software and Project issues as videos
• Ask Tech Query
• Post Blogs