C++ program – calculate a to the power b without using power function

by Nideesh C on April 14, 2011 · 0 comments

in C++




#include<iostream.h>
#include<conio.h>
void main()
{
	int a,b,i,temp=1;
	clrscr();
	cout<<"Enter number for operation";
	cin>>a>>b;
	for(i=1;i<=b;i++)
	{
		temp=temp*a;
	}
	cout<<endl<<"Result are:: "<<temp;
	getch();
}



Not Satisfied ? Just search & get the result

Related Posts Plugin for WordPress, Blogger...
Be Sociable, Share!

Related posts:

  1. C program to read two integers M and N and to swap their values. Use a user-defined function for swapping. Output the values of M and N before and after swapping with suitable messages
  2. How to monitor switch activity and its performance with LED Light
  3. C program to find the value of sin(x) using the series up to the given accuracy (without using user defined function) Also print sin(x) using library function.
  4. C program to find the value of cos(x) using the series up to the given accuracy (without using user defined function) Also print cos(x) using library function.
  5. C++ program – calculate the factorial of a number using recursion.

Leave a Comment

Previous post:

Next post: