Adsense 728 * 15


Custom Search

Program to Calculate Power of Number

Write a program to calculate power of a number without using pow() function.

Let's say you have to calculate 23     . so it calculate like 2 * 2 * 2 = 8. To solve this problem take input number and it's power from user. Run while loop until the count is less than or equal to enter value of power and calculate the sum.

Program to Calculate Power of Number


int main(){

  int pow,num,count=1;
  int sum=1;
  printf("Enter number ");
  printf("Enter power of a number ");

  printf("The power of %d is %d",num,sum);

  return 0;

Output -

Enter number  2

Enter power of a number 3

The power of 2 is 8.

Program to count number of words.

Program to reverse a number.

No comments:

Post a Comment