Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

c program to subtract between two numbers without using '-'
sign and subtract function.

Answer Posted / davic uwihoreye

Write a c program or code to subtract two numbers without
using subtraction operator


#include<stdio.h>

int main(){

int a,b;
int sum;

printf("Enter any two integers: ");
scanf("%d%d",&a,&b);

sum = a + ~b + 1;

printf("Difference of two integers: %d",sum);

return 0;
}

Sample Output:

Enter any two integers: 5 4
Difference of two integers: 1

Is This Answer Correct ?    9 Yes 1 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

Can you define which header file to include at compile time?

980


a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above

1166


What is the use of sizeof () in c?

987


hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell

2135


What are c identifiers?

1038


How does placing some code lines between the comment symbol help in debugging the code?

937


How do I determine whether a character is numeric, alphabetic, and so on?

1066


What are multidimensional arrays?

1059


Write a C program to count the number of email on text

1851


Which of the following operators is incorrect and why? ( >=, <=, <>, ==)

1109


Which is more efficient, a switch statement or an if else chain?

967


program for reversing a selected line word by word when multiple lines are given without using strrev

2418


What is wild pointer in c with example?

1017


Differentiate fundamental data types and derived data types in C.

983


What is character constants?

1127