Wednesday, November 24, 2021

Subtract Two Numbers Without Using Subtraction Operator in C++

  A simple program that I wrote using C++ programming language that will ask the user to give two number and then the program will subtract the difference of two numbers without using subtraction operator.

 I am currently accepting programming work, IT projects, school and application development, programming projects, thesis and capstone projects, IT consulting work, computer tutorials, and web development work kindly contact me at the following email address for further details.  If you want to advertise on my website kindly contact me also in my email address also. Thank you.

My email address is the following jakerpomperada@gmail.com, jakerpomperada@aol.com, and jakerpomperada@yahoo.com.

My mobile number here in the Philippines is 09173084360.




Program Listing

/* Subtract two numbers without using subtraction operator */


#include <iostream>


int main(){

    

int x=0,y=0,sum=0;

    

    std::cout <<"\n\n";

    std::cout <<"\tSubtract Two Numbers Without Using Subtraction Operator in C++";

std::cout <<"\n\n";

    /* Input Here */

    std::cout <<"\tGive Two Numbers : ";

    std::cin >> x >> y;

    /* Computation Here */

sum = x + ~y + 1;

    

     /* Output */

    std::cout <<"\n\n";

std::cout <<"\tDifference between " << x <<

       " and " << y << " is " << sum << ".";

    std::cout <<"\n\n";

    std::cout <<"\tEnd of Program";

    std::cout <<"\n\n";

}

No comments:

Post a Comment