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

what will be the output of this program main() { int i=1; while (i<=10); { i++; } }

11 Answers  


WRITE A C PROGRAM FOR PRINT "RHOMBUS" STRUCTURE . Example: Enter the numbers :3 * * * * * * * *

3 Answers   Infosys, TCS,


What is the best style for code layout in c?

1 Answers  


Whether there can be main inside another main?If so how does it work?

14 Answers   Sail, Wipro,


What is C language ?

1 Answers   Jekson,


What is the difference between a function and a method in c?

1 Answers  


What is conio h in c?

1 Answers  


One of the Institutes contains 5 student groups. Every group contains 4 students. Institute wants to store student group’s details in array. Group should contain group member’s details (name and registration number and age), project name, and mark of the group.

1 Answers  


Explain what is operator promotion?

1 Answers  


What is typeof in c?

1 Answers  


if (i = 0)printf ("True"); elseprintf("False"); Under what conditions will the above print out the string "True" a) Never b) Always c) When the value of i is 0 d) all of the above

1 Answers  


How will you print TATA alone from TATA POWER using string copy and concate commands in C?

1 Answers   Amdocs, Apps Associates,


Categories