Thursday, May 15, 2008 at 11:19 PM |  

MULTIPLICATION
WITHOUT
USING * OPARETOR

#include<stdio.h>

#include<conio.h>

int a,b,i,c,d,k=1,l=0;

int multi(int,int);

void main()

{

clrscr();

printf("Enter two digits to multiply");

scanf("%d%d",&a,&b);

i=multi(a,b);

printf("The result is=%d",i);

getch();

}

int multi(int c,int d)

{

if(k<=b)

{

l=l+a;

k++;

multi(a,b);

}

return(l);

}


 

Explanations: -
Here I use recursion function to solve this prob. Multiplication is a process where one number, In between two numbers is just added as many times as the second number. In this above problem I just implement the above logic.

Try it out.

Posted by Satyabrota

0 comments: