Thursday, December 12, 2013
Home »
Program Number Raise To the Power by Loop
,
Program to calculate power of a number by for loop
» Program Number Raise To the Power by Loop
Program Number Raise To the Power by Loop
/*
Write a C++ Program to get two numbers from the user,
and Calculates and displays the result of first number
raise to the power of second number. Use For Loop.
For Free C++ Programming Techniques (Example Programs), visit
Www.EasyCppProgramming.Blogspot.Com
and For Good Notes
Visit Www.ForFreeEducation.Blogspot.Com
*/
#include<iostream.h>
#include<conio.h>
void main()
{
clrscr();
int number, power, counter;
long result=1;
cout<<"\n Enter the Number = ";
cin>>number;
cout<<"\n Enter the power = ";
cin>>power;
for ( counter = 1; counter <= power; counter++)
result = result * number;
cout<<"\n\n ----------- Results ------------";
cout<<"\n\n The Result of "<<number<<" rasie to the power "<<power<<"\nis "<<result;
getch();
}
0 comments:
Post a Comment
We Love To Hear From You!