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

What is structure in c definition?

1056


On most computers additional memory that is accessed through an adapter of feature card along with a device driver program. a) user memory b) conventional memory c) expandedmemory d) area

1123


Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.

1280


When should the volatile modifier be used?

1184


can anyone please tell about the nested interrupts?

2125


What is #define used for in c?

1066


how to make a scientific calculater ?

2075


find the sum of two matrices and WAP for it.

1140


What is getch () for?

1240


why programs in c are running with out #include? some warnings are display in terminal but we execute the program we get answer why? eg: main() { printf("hello world "); }

1768


When should you not use a type cast?

1127


Why main is used in c?

1078


find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }

2314


When was c language developed?

1196


Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;

1074