Untitled

 avatar
unknown
plain_text
a year ago
1.6 kB
4
Indexable
#include<iostream>
using namespace std;
void sum();
void sub();
void div();
void square(int);
void mul();
int main()

{
    /*view();
    cout<<"Back to future."<<endl;
    view();
    cout<<"Back to past."<<endl;*/
    cout<<"Sum: "<<endl;
    sum();
    cout<<"Sub: "<<endl;
    sub();
    cout<<"Div: "<<endl;
    div();
    cout<<"Mul: "<<endl;
    mul();
    cout<<"Square: "<<endl;
    int sq;
    cout<<"Enter the value: ";
    cin>>sq;
    square(sq);
}

void view()
{
    string name;
    int age;
    cout<<"Enter Your name: ";
    cin>>name;
    cout<<"Enter your age: ";
    cin>>age;

    cout<<"Name: "<<name<<endl;
    cout<<"Age: "<<age<<endl;

}

void sum()
{   int x;
    int y;
    cout<<"Enter The First value: ";
    cin>>x;
    cout<<"Enter The second value: ";
    cin>>y;
    int result=x+y;
    cout<<"Summation: "<<result<<endl;
}
void sub()
{   int x;
    int y;
    cout<<"Enter The First value: ";
    cin>>x;
    cout<<"Enter The second value: ";
    cin>>y;
    int result=x-y;
    cout<<"Substraction: "<<result<<endl;
}
void div()
{   int x;
    int y;
    cout<<"Enter The First value: ";
    cin>>x;
    cout<<"Enter The second value: ";
    cin>>y;
    float result=(float)x/y;
    cout<<"Divition: "<<result<<endl;
}
void mul()
{   int x;
    int y;
    cout<<"Enter The First value: ";
    cin>>x;
    cout<<"Enter The second value: ";
    cin>>y;
    int result=x*y;
    cout<<"Multiplication: "<<result<<endl;
}
void square(int x)
{
    int result=x*x;
    cout<<"Square: "<<result<<endl;
}
Editor is loading...
Leave a Comment