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

Why should I use standard library functions instead of writing my own?

1313


Why is c faster?

1178


What is the use of bit field?

1228


A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.

1763


write a program in C that prompts the user for today's date,tomorrow's date and display the results.Use structures for today's date,tomorrow's date and an array to hold the days for each month of the year.

5496


Write a factorial program using C.

1117


What are the applications of c language?

1121


How can I get the current date or time of day in a c program?

1267


Is c procedural or object oriented?

1083


What is the difference between typedef struct and struct?

1162


How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?

1082


Define and explain about ! Operator?

1041


process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,

2473


What are the advantages of using Unions?

1169


How do you construct an increment statement or decrement statement in C?

1272