• Python

    Implement The Basic Calculator

    Here we are using basic operator and function to implement basic calculator. This program provide basic use of operator and how to work with function. con=1 while con==1: no1=int(input("Enter First Value ")) no2=int(input("Enter Second Value ")) print("Choice") print("1. Add") print("2. Subtract") print("3. Multiplication") print("4. Division") choice=int(input("Enter Choice ")) def Add(): return (no1+no2) def Sub(): return (no1-no2) def Mul(): return (no1*no2) def Div(): return (no1/no2) def perform_op(choice): if choice == 1: print(Add()) elif choice == 2: print(Sub()) elif choice == 3: print(Mul()) elif choice == 4: print(Div()) else: print("*** Invalid Choice ***") perform_op(choice) con=int(input("Do You Want To Continue "))   OutPut…

  • C++ Language

    If…Else Statement In C++

    In if…else statement, if the condition is true then the statements inside if statements are executed, and if the condition is false then statements inside else are executed. Syntax if(Condition or Expression) { //Statements } else { //Statements } Example #include <iostream> using namespace std; int main() { int number; cout << "Enter an integer value: "; cin >> number; if ( number >= 0) { cout << "You entered a positive integer: " << number << endl; } else { cout << "You entered a negative integer: " << number << endl; } cout << "This line is always…