free c programming course
Friday, 1 February 2013
Add Two numbers without using operator
#include<stdio.h>
int
main
(){
int
a
,
b
;
int
sum
;
printf
(
"Enter any two integers: "
);
scanf
(
"%d%d"
,&
a
,&
b
);
//sum = a - (-b);
sum
=
a
-
~
b
-
1
;
printf
(
"Sum of two integers: %d"
,
sum
);
return
0
;
}
No comments:
Post a Comment
Newer Post
Older Post
Home
Subscribe to:
Post Comments (Atom)
No comments:
Post a Comment