Oops! It appears that you have disabled your Javascript. In order for you to see this page as it is meant to appear, we ask that you please re-enable your Javascript!

Power of a number program in CPlusPlus (C++, CPP) and C with flowchart

Power of a number program in CPlusPlus (C++, CPP) and C with the flowchart

In this tutorial, we will learn about the followings;

  1. Flowchart of a program of the power of a number
  2. Power of a number program in CPlusPlus (C++, CPP) 
  3. Power of a number program in C

Flowchart of a program of the power of a number

Coming Soon.

Power of a number program in CPlusPlus (C++, CPP) 

#include <iostream>
#include <conio.h>
using namespace std;
int main()
  {
   int base;
   int power;
   int x,result=1;
   cout<<"Enter base: ";
   cin>>base;
   cout<<"Enter power: ";
   cin>>power;
   for(x=power;x>0;x--)
   {
   result=result*base;
   }
   cout<<"Result of power is: "<<result;

  getch();
  }

Output

Power of a number program in CPlusPlus (C++, CPP) and C with flowchart

Figure: Power of a number program in CPlusPlus (C++, CPP) and C with the flowchart.

Power of a number program in C

#include <stdio.h>
 int main()
  {
   int base;
   int power;
   int x,result=1;
   printf("Enter base: ");
   scanf("%d", &base);
   printf("Enter power: ");
   scanf("%d", &power);
   for(x=power;x>0;x--)
   {
   		result= result*base;
   }
   printf("Result of Power is: %d", result);

  return 0;
  }

Output

Power of a number program in CPlusPlus (C++, CPP) and C with flowchart

Figure: Power of a number program in CPlusPlus (C++, CPP) and C with the flowchart.

Fazal Rehman Shamil Click Here to Know More
Instructor, Researcher, Blogger, SEO Expert, Poet and Publisher of International Journal Of Software, Technology & Science ISSN : 2616 - 5325
Dear Professors and Resarchers!You are welome to Cite these tutorials in your research or slides etc. Please don't forget to mention the reference of website. Copy Paste of text is strcitly forbidden. Images can be reuse because images are protected with watermark.

Leave a Reply

Your email address will not be published. Required fields are marked *