Sunday, 4 September 2016

write a program accept two numbers find the product of two number's without using multiplication operator

main()
{
  
int m,n,product=0;
printf('enter number's");
scanf("%d%d",&m,&n);
while(m)                                 //let m=4,n=3;
{
product=product+n;           //product=produt+3;
m--;                                      //m==3 after this m value assign to while condition and and this loop
                                            //itrating till tym when m eqalto 0 and condition become folse meanse loop itrating for time then product also add 3 for times...that is 3+3+3+3 that is nating bt same as 3*4 =12 
}
printf("%d",product");
getch();
}   

No comments:

Post a Comment