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

Do character constants represent numerical values?

1334


Why clrscr is used in c?

1014


What is the use of volatile?

1082


difference between Low, Middle, High Level languages in c ?

2079


What are multidimensional arrays?

1114


What are identifiers and keywords in c?

1093


What is pointer to pointer in c language?

1136


What is the meaning of typedef struct in c?

1065


What is a structure in c language. how to initialise a structure in c?

1062


Why does not c have an exponentiation operator?

1047


Explain what are linked list?

1041


how logic is used

1965


What is the purpose of type declarations?

1114


FILE *fp1,*fp2; fp1=fopen("one","w") fp2=fopen("one","w") fputc('A',fp1) fputc('B',fp2) fclose(fp1) fclose(fp2)} a.error b. c. d.

1743


What is the right type to use for boolean values in c?

1029