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
What is structure in c definition?
On most computers additional memory that is accessed through an adapter of feature card along with a device driver program. a) user memory b) conventional memory c) expandedmemory d) area
Find the second largest element in an array with minimum no of comparisons and give the minimum no of comparisons needed on an array of size N to do the same.
When should the volatile modifier be used?
can anyone please tell about the nested interrupts?
What is #define used for in c?
how to make a scientific calculater ?
find the sum of two matrices and WAP for it.
What is getch () for?
why programs in c are running with out #include
When should you not use a type cast?
Why main is used in c?
find the output? void r(int a[],int c, int n) { if(c>n) { a[c]=a[c]+c; r(a,++c,n); r(a,++c,n); } } int main() { int i,a[5]={0}; r(a,0,5); for(i=0;i<5;i++) printf("\n %d",a[i]); getch(); }
When was c language developed?
Which is not valid in C a) class aClass{public:int x;}; b) /* A comment */ c) char x=12;