Skip to Main Content
Programming and Data Structures
book

Programming and Data Structures

by Ashok Kamthane
August 2009
Intermediate to advanced content levelIntermediate to advanced
604 pages
21h 39m
English
Pearson India
Content preview from Programming and Data Structures
Loop Control Statements 137
6.21 Perform multiplication of two integers by using negative sign.
# include <conio.h>
# include <math.h>
mainO
{
in t a ,b ,c,d « 0 ;
c l r s c r () ;
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
Explanation The 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 ( ' a 7) is repeatedly added to ' b 7 (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.
Start your free trial

You might also like

Learning Data Structures and Algorithms

Learning Data Structures and Algorithms

Rod Stephens
Data Structures and Algorithms in C++, Second Edition

Data Structures and Algorithms in C++, Second Edition

Michael T. Goodrich, Roberto Tamassia, David M. Mount

Publisher Resources

ISBN: 9789332506343