Feb 16, 2020

C Program To Print Sum Of Two Numbers Without Using Arithmetic '+' Operator

Ex: Write a C Program To Print Sum Of Two Numbers Without Using Arithmetic  '+' Operator. How to write a C Program To Print Sum Of Two Numbers Without Using Arithmetic  '+' Operator. C Program To Print Sum Of Two Numbers Without Using Arithmetic  '+' Operator.

Input from user:
Enter number 1: 10
Enter number 2: 5

Expected output:
Sum = 15





Program:


#include<stdio.h>
void main()
{
int no1,no2,no3;

printf("enter no1\n");    
     scanf("%d",&no1);
     printf("enter no2\n");    
     scanf("%d",&no2);
    /*Here, we have used minus minus become plus logic*/
    no3=no1-(-no2);
   
   printf("Addition is=%d",no3);

}


Above Program show's the following output:


C program to print sum of two numbers without using arithmetic operator




No comments:

Post a Comment

If you have any doubts, please discuss here...