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

Answers were Sorted based on User's Feedback



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

Answer / 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

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

Answer / 080132

Do anybody give correct ans

Is This Answer Correct ?    2 Yes 2 No

Post New Answer

More C Interview Questions

write a c program that if the given number is prime, and their rearrangement(permute) of that number is also prime. Ex: Input is "197" is prime Output: 791,917,179 is also prime. Please any one tell me tha code for that

3 Answers  


How do you initialize function pointers? Give an example?

3 Answers  


YBJBU6

1 Answers  


Explain the concept and use of type void.

0 Answers  


ASCII stands for

1 Answers  






print out of string in this format; 1. "rajesh" 2. \n 3. %d

5 Answers   mpower,


What is the difference between specifying a constant variable like with constant keyword and #define it? i.e what is the difference between CONSTANT FLOAT A=1.25 and #define A 1.25

0 Answers  


Can we increase size of array in c?

0 Answers  


How can I invoke another program from within a C program?

8 Answers  


How can I display a percentage-done indication that updates itself in place, or show one of those twirling baton progress indicators?

0 Answers  


about c language

0 Answers  


When can a far pointer be used?

0 Answers  


Categories