Monday 17 September 2012

Write a program to calculate power of particular number?


Example: 4=625
              5
PROGRAM
/* c program for calculator power of number*/
#include<stdio.h>
#include<conio.h>
int main()
{
 int num,pow,res=1;
 printf("\nEnter number and power : ");
 scanf("%d %d",&num,&pow);
 while(pow>=1)
 {
  res=res*num;
  pow--;
 }
 printf("%d",res);
 return 0;
}

 OUTPUT
Enter number and power : 5
4
625

No comments:

Post a Comment