Golgappa.net | Golgappa.org | BagIndia.net | BodyIndia.Com | CabIndia.net | CarsBikes.net | CarsBikes.org | CashIndia.net | ConsumerIndia.net | CookingIndia.net | DataIndia.net | DealIndia.net | EmailIndia.net | FirstTablet.com | FirstTourist.com | ForsaleIndia.net | IndiaBody.Com | IndiaCab.net | IndiaCash.net | IndiaModel.net | KidForum.net | OfficeIndia.net | PaysIndia.com | RestaurantIndia.net | RestaurantsIndia.net | SaleForum.net | SellForum.net | SoldIndia.com | StarIndia.net | TomatoCab.com | TomatoCabs.com | TownIndia.com
Interested to Buy Any Domain ? << Click Here >> for more details...

write a program for 7*8 = 56 ? without using * multiply
operator ? output = 56

Answer Posted / pavan_mustyala

Method1:
optimised code is to "left shift" the number 7 by 3 times.

Reason: 8 is (2 raised to power 3). So (7 * 8) is
equivalent to (((7*2)*2)*2). To multiply a number by 2,
shift it by 1 bit Left.

Method2:
Not optimised but it works. Addition in a loop.

int func()
{
int i;
int result = 0;

for(i = 0; i < 8; i++)
{
result = result + 7;
}
return result;
}

Is This Answer Correct ?    14 Yes 4 No



Post New Answer       View All Answers


Please Help Members By Posting Answers For Below Questions

What is typedef struct in c?

1042


What is the purpose of sprintf() function?

1110


How many types of arrays are there in c?

1036


What is the concatenation operator?

1144


Can we declare variable anywhere in c?

964


a character or group of characters that defines a register,or a part of storage a) memory b) byte c) address d) linear list

996


Explain what happens if you free a pointer twice?

1070


What is difference between union and structure in c?

1152


What is the purpose of the preprocessor directive error?

1262


void main(int n) { if(n==0) return; main(--n); printf("%d ",n); getch(); } how it work and what will be its output...............it any one know ans plz reply

2765


How many keywords are there in c?

1073


Explain what is the best way to comment out a section of code that contains comments?

1129


Why is it important to memset a variable, immediately after allocating memory to it ?

2060


hw can we delete an internal node of binary search tree the internal node has child node..plz write progarm

2015


What does c mean in standard form?

1168