6.21 Perform multiplication of two integers by using negative sign.
# include <conio.h>
# include <math.h>
mainO
{
int a,b,c,d«0;
clrscr();
printf ("\tt Enter two numbers
scanf ("%d %d", &a,&b);
for(c=l;c<=b;c++)
d=(d)-(-a);
printf (" Multiplication of%d * %d :%d",a,b,d);
I
p.umnj
Enter two numbers : 5 5
Multiplication of 5 * 5 : 25
ExplanationThe multiplication is nothing but repetitive addition. For example multiplication of
5 x 5 is 25 and the result is obtained by adding 5,5 times. Here, the two numbers are entered and the
1st number (' a7) is repeatedly added to ' b7 (2nd number) ...
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month, and much more.