This blog consists of C and C++ programs. C and C++ programming is the basics to learn any programming language. Most of the programs are provided with their respective outputs. This blog also contains Data Structures programs using Object-Oriented Programming (C++). Some of the best books for learning C and C++ programming are also mentioned.

Wednesday 7 August 2013

Program to calculate the Power of a number using WHILE loop (1)

#include<stdio.h>
#include<conio.h>
void main()  
{  
int bas, exp, count = 1, power = 1 ;  
clrscr() ;  
printf("Enter the value of base number: ") ;
scanf("%d", &bas) ;  
printf("\nEnter the value of exponent : ") ;  
scanf("%d", &exp) ;
while(count <= exp)  
{  
power = power * bas ;  
count ++ ;  
}  
printf("\nThe value of %d power %d = %d", bas, exp, power) ;
getch() ;  
}


No comments:

Post a Comment