Loading
View RSS Feed

prafic

C Program To Find The Value Of x^n

Rating: 7 votes, 5.00 average.
/* Program to find the value of x^n - POWER.C */
Code:
# include <stdio.h>
# include <conio.h>
void main()
{
int x, n, count = 1, sum = 1 ;
clrscr() ;
printf("Enter the value of x : ") ;
scanf("%d", &x) ;
printf("\nEnter the value of n : ") ;
scanf("%d", &n) ;
while(count <= n)
{
sum = sum * x ;
count ++ ;
}
printf("\nThe power of %d^%d is : %d", x, n, sum) ;
getch() ;
}
OUTPUT

RUN 1 :
---------
Enter the value of x : 2
Enter the value of n : 4
The power of 2^4 is : 16

Submit "C Program To Find The Value Of x^n" to Digg Submit "C Program To Find The Value Of x^n" to del.icio.us Submit "C Program To Find The Value Of x^n" to StumbleUpon Submit "C Program To Find The Value Of x^n" to Google

Updated 03-07-2011 at 06:37 PM by Harsh

Categories
C C++

Comments




Disclaimer: Users of techforum4u.com are responsible for ensuring that any material they post (article, blog posts, images or other mulitimedia content) does not violate or infringe upon the copyright, patent, trademark, or any personal or proprietary rights of any third party, and is posted with the permission of the owner of such rights.Anyone who violates these rules may have their access privileges removed without warning.