Computer Science, asked by psnarendren27, 11 months ago

Write equivalent C++ statement for the Mathematical equation z=x^y.​

Answers

Answered by nidaeamann
0

Explanation:

C++ is one of the basic computer programming language. A program fulfilling the requirements of the mathematical expression can be written as;

Program code;

Int main ( int x, int y)

{

int z = 1;

for (int i = 0; i < y; i++)

{

z = z * x;

}

Return z

}

The program takes input of x and y and return the value of z

Answered by dikshaverma4you
0

This is a user defined C++ program for your required question.

#include<iostream.h>

#include<conio.h>

#include<process.h>

#include<math.h>

void main()

{

clrscr();

int x,y,z;

char ch;

A:

cout<<"Enter the value of base (x) "<<endl;

cin>>x;

cout<<"Enter the value of exponent (y)"<<endl;

cin>>y;

z= pow(x,y);

cout<<" The value of z is "<<z<<"."<<endl;

cout<<" Do you want to calculate again for other numbers ?"<<endl;

cin>>ch;

if(ch=='y')

{

goto A;

}

if(ch=='n')

{

exit(0);

}

getch();

}

Some similar questions related to C++ are as under:-

https://brainly.in/question/6172559

https://brainly.in/question/14581229

https://brainly.in/question/13084271

Similar questions
Math, 5 months ago