c program to subtract between two numbers without using '-'
sign and subtract function.
Answers were Sorted based on User's Feedback
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 |
What is bubble sort technique in c?
How do you access command-line arguments?
What is null pointer constant?
What will the preprocessor do for a program?
b) 4 c) 6 d) 7 32. Any C program a) must contain at least one function b) need not contain ant function c) needs input data d) none of the above 33. Using goto inside for loop is equivalent to using a) continue b) break c) return d)none of the above 34. The program fragment int a=5, b=2; printf(“%d”,a+++++b); a) prints 7 b)prints 8 c) prints 9 d)none of the above 35. printf(“ab” , “cd”,”ef”); prints a) ab abcdef c) abcdef, followed by garbage value d) none of the above 36. Consider the following program segment. i=6720; j=4; while((i%j)==0) { i=i/j; j=j+1; } On termination j will have the value a) 4 b) 8 c) 9 d) 6720
if array a conatins 'n' elements and array b conatins 'n-1' elements.array b has all element which are present in array a but one element is missing in array b. find that element.
18 Answers Parexel, Ram Infotech, Zycus Infotech,
can we declare a function in side the structure?
int main() { int days; printf("enter days you are late"); scanf("%d",days); if (days<=5) printf("5o paisa fine"); if (days<=10&&days>=6) printf("1rs fine"); if(days>10) printf("10 rs fine"); if(days=30) printf("membership cancelled"); return 0; } tell me whats wrong in this program? is it right?
wt is diference between int and int pointer as same as float and float pointer and char and char pointer
What is meant by gets in c?
How to reverse a linked list
1 Answers Aricent, Fidelity, IBM, TCS,
What is the -> in c?