Wednesday 1 June 2016

Write a program that inputs two numbers in main function and passes them to a function. The function displays first number raised to the power of second.

#include<iostream.h>
#include<conio.h>
#include<math.h>
void power(int n1, int n2);
void main()
{
        clrscr();
        int num1,  num2;
        cout<<"Enter two numbers: ";
        cin>>num1>>num2;
        power(num1, num2);
        getch();
}
void power(int n1, int n2)
{
        cout<<n1<<" raised to the power of "<<n2<<" is : "<<pow(n1,n2);
}

Share:

0 comments:

Post a Comment

Popular Posts

Recent Posts

Unordered List

Text Widget

Pages

About Me

My photo
A group of two, with a little hope of helping beginners to learn how to code :)
Powered by Blogger.

Comments

Facebook

Ad Home

Follow Us

Random Posts

Sponsor

Recent Posts

Header Ads

Popular Posts

Copyright © Functions in C++ | Powered by Blogger

Design by ThemePacific | Blogger Theme by NewBloggerThemes.com | Distributed By Blogger Templates20