Add two numbers without using Arithmetic Operators
#include<stdio.h>
#include<conio.h>
void add(int m,int n)
{
printf("%d",printf("%*c%*c",m," ",n," "));
}
int main()
{
add(3,5);
getch();
}
General syntax:-
printf("%*d",width,char);
where width is substituted in place of * in %*d and char is printed the number of times the width.
Explanation:-
In the above program " " is first printed m times followed by n times.So printf will return total number of " " which is nothing but m+n.
Output:-
8
Comments
Post a Comment