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
Can you define which header file to include at compile time?
a c variable cannot start with a) an alphabet b) a number c) a special symbol d) both b and c above
What is the use of sizeof () in c?
hello freinds next week my interview in reliance,nybody has an idea about it intervew questions..so tell
What are c identifiers?
How does placing some code lines between the comment symbol help in debugging the code?
How do I determine whether a character is numeric, alphabetic, and so on?
What are multidimensional arrays?
Write a C program to count the number of email on text
Which of the following operators is incorrect and why? ( >=, <=, <>, ==)
Which is more efficient, a switch statement or an if else chain?
program for reversing a selected line word by word when multiple lines are given without using strrev
What is wild pointer in c with example?
Differentiate fundamental data types and derived data types in C.
What is character constants?