difference of two no's with out using - operator

Answer Posted / gg

Try this....

main()
{
int a,b;
printf("Enter two integers \n");
scanf("%d%d",&a,&b);
printf("The diff is : %d ",a+(~b+1));
}

Is This Answer Correct ?    3 Yes 0 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is wild pointer in c with example?

570


Is register a keyword in c?

630


Explain what is the best way to comment out a section of code that contains comments?

711


Differentiate between new and malloc(), delete and free() ?

664


What is structure in c language?

613






Is there any data type in c with variable size?

628


If a variable is a pointer to a structure, then which operator is used to access data members of the structure through the pointer variable?

775


What is the use of structure padding in c?

560


which is conditional construct a) if statement b) switch statement c) while/for d) goto

734


‘ C’ PROGRAME TO SHOW THE TYPE OF TRANGLE BY ACCEPTING IT’S LENGTH .

2367


Write a program to swap two numbers without using the third variable?

591


In C, What is the #line used for?

1045


Can I use base-2 constants (something like 0b101010)? Is there a printf format for binary?

570


Why is a semicolon (;) put at the end of every program statement?

620


Explain the advantages and disadvantages of macros.

619