Hi, I need help with a program that you enter X and Y, and the program has to resolve
a)X^Y *Y
b)X/Y

it most be recursively and only using addition and subtraction.
For division the result most has 2 digits of precision but only using integer
example
INPUT OUTPUT
X=1 , Y=5 5 0.20

So, you have tried what exactly?

Whats the question? we arn't going to write your code for you

this is what i have done

#include <iostream>
#include <conio.h>
using namespace std ;
int x,y,r,a,b,w;
//Pow
int Pow(int x,int y)
{
    if(y==0)
        return 1;
    else
        return x*Pow(x,(y-1));
};
//multi
int Mult(int r, int y)
{
     if( y==0)
         return 0;
     else
         return r + Mult(r,(y-1));
};
//DIVISION
int Div(int x, int y)
{
    if(x>0 && y==0)
           return 0;
    else if(x>0 && y==1)
           return x;
    else if (x<y){
             cout<<".";
             b=1+(((x*100)-y)/y);
             return b;
    }else
    {
           b=1+((x-y)/y);
             return b;
    }
};
int main()
{
    cin>>x;
    cin>>y;
    r=Pow(x,y);
    a=Mult(r,y);
    cout<<a<<"    ";
    b=Div(x,y);
    cout<<b;
    getch();
    return 0;
}

but For division the result most has 2 digits of precision but only using integer and i dont know how to do that

Well you know how to do divison by hand on paper?

DIvision by hand is usually done by integer only, replicate this in your code.

Be a part of the DaniWeb community

We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.