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
Why should I use standard library functions instead of writing my own?
Why is c faster?
What is the use of bit field?
A program is required to print your biographic information including: Names, gender, student Number, Cell Number, line of study and your residential address.
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.
Write a factorial program using C.
What are the applications of c language?
How can I get the current date or time of day in a c program?
Is c procedural or object oriented?
What is the difference between typedef struct and struct?
How can I write data files which can be read on other machines with different word size, byte order, or floating point formats?
Define and explain about ! Operator?
process by which one bit patten in to another by bit wise operation is? (a) masking, (b) pruning, (c) biting, (d) chopping,
What are the advantages of using Unions?
How do you construct an increment statement or decrement statement in C?