Welcome

Hi! This blog is for beginners of c++ and java .You can check and pick codes for your programming assignments. This will also help you to understand the concepts of these programming languages. Its all about programming.

Loops Practise(Power number Program)

Wednesday, May 18, 2011

#include <iostream.h>
int main()
{
    long int n=0;
    long int p;
    long int a=1;
    cout <<"Enter The Number Whose Power You Want To CAlculate = ";
    cin >> n;
    cout <<"\n Enter Power = ";
    cin >> p;
    cout <<endl;
    if (p==0)
    {    a=1;
    }
    while (p>0)
    {
        a=a*n;
        p--;
    }
    cout <<" Answer Is = " << a;
    return 0;
}