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
Do character constants represent numerical values?
Why clrscr is used in c?
What is the use of volatile?
difference between Low, Middle, High Level languages in c ?
What are multidimensional arrays?
What are identifiers and keywords in c?
What is pointer to pointer in c language?
What is the meaning of typedef struct in c?
What is a structure in c language. how to initialise a structure in c?
Why does not c have an exponentiation operator?
Explain what are linked list?
how logic is used
What is the purpose of type declarations?
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.
What is the right type to use for boolean values in c?