Change the following C++ code to C language code #include <iostream> using std::
ID: 3615057 • Letter: C
Question
Change the following C++ code to C language code#include <iostream>
using std::cout; using std::endl; using std::cin;
int integerPower( int, int );
int main() { int exp, base;
cout << "Enter base and exponent: "; cin >> base >> exp; cout << base << " to the power " <<exp << " is: " << integerPower( base, exp ) << endl;
return 0; }
int integerPower( int b, int e ) { int product = 1;
for ( int i = 1; i <= e; ++i ) product *= b;
return product; }
#include <iostream>
using std::cout; using std::endl; using std::cin;
int integerPower( int, int );
int main() { int exp, base;
cout << "Enter base and exponent: "; cin >> base >> exp; cout << base << " to the power " <<exp << " is: " << integerPower( base, exp ) << endl;
return 0; }
int integerPower( int b, int e ) { int product = 1;
for ( int i = 1; i <= e; ++i ) product *= b;
return product; }
#include <iostream>
using std::cout; using std::endl; using std::cin;
int integerPower( int, int );
int main() { int exp, base;
cout << "Enter base and exponent: "; cin >> base >> exp; cout << base << " to the power " <<exp << " is: " << integerPower( base, exp ) << endl;
return 0; }
int integerPower( int b, int e ) { int product = 1;
for ( int i = 1; i <= e; ++i ) product *= b;
return product; } return product; }
Explanation / Answer
#include<conio.h> #include<iostream.h> int integerPower( int, int );void main() { int exp, base; clrscr();
printf("Enterbase:"); //Get base scanf("%d",base); printf("EnterExponent"); //Get Exponent scanf("%d",exp) printf("%d to the power %d is: %d",base,exp,integerPower( base, exp )); //calling the function getch(); }
int integerPower( int b, int e ) { int product = 1;
for (int i = 1; i <= e; i++ ) product =product*b; returnproduct; //Function will return the calculatedvalue
Related Questions
Hire Me For All Your Tutoring Needs
Integrity-first tutoring: clear explanations, guidance, and feedback.
Drop an Email at
drjack9650@gmail.com
drjack9650@gmail.com
Navigate
Integrity-first tutoring: explanations and feedback only — we do not complete graded work. Learn more.