Tuesday, 20 March 2012

C++ Program to subtract two numbers without using minus (' - ') operator


/*logic to add two numbers in c++ without using plus operator*/
//for positive output use if condition this code will show negative output 

#include<stdio.h>
using namespace std;
int main()
 {
       int a=25,j=200,i;
      for(i=0;i<j;i++)
           {
             a--;
            }
      cout<<a<<endl;
 }
/* output will=> -175 */

No comments:

Post a Comment

Compiler for C,C++ and Python {paste your programme to see the output}