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

Answers were Sorted based on User's Feedback



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

Answer / guest

add 7 ,8 times & u 'll get the output
we can use while loop,or for loop

Is This Answer Correct ?    29 Yes 2 No

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

Answer / banavathvishnu

int main()
{

printf("%d",7<<3);
getch();
}

Is This Answer Correct ?    30 Yes 7 No

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

Answer / 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

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

Answer / rama krishna sidhartha

Here is the logic.
void func()
{
int i;
int result = 0;
for(i = 0; i < 8; i++)
{
result = result + 7;
}
printf("%d",result);
}

Is This Answer Correct ?    8 Yes 3 No

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

Answer / manish soni bca 3rd year jaipu

#include<stdio.h>
#include<conio.h>
void main()
{
int i,ans;
ans=0;
for(i=0;i<8;i++)
ans=ans+7;
printf("%d",ans);
getch();
}

Is This Answer Correct ?    5 Yes 1 No

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

Answer / raju kalyadapu

int main()
{
int i=0,n=0;
while(i++<8)
n=n+7;
printf("7 * 8 is:%d",n);
}

Is This Answer Correct ?    0 Yes 0 No

Post New Answer

More C Interview Questions

Write a function expand(s1,s2) that expands shorthand notations like a-z in the string s1 into the equivalent complete list abc...xyz in s2 . Allow for letters of either case and digits, and be prepared to handle cases like a-b-c and a-z0-9 and -a-z. z-a:zyx......ba -1-6-:-123456- 1-9-1:123456789987654321 a-R-L:a-R...L a-b-c:abbc

0 Answers  


main() { int x=20,y=35; x = y++ + x++; y = ++y + ++x; printf("%d %d\n",x,y); }

27 Answers   Advent Global Solutions, CitiGroup, Valeo Lighting Systems India Private Limited, Vishal Transformers, Wipro, Zencer,


What does typeof return in c?

0 Answers  


I want tcs placement papers of 2004-2009 , its urgent

6 Answers   TCS, Wipro,


How to reverse a string using a recursive function, without swapping or using an extra memory?

31 Answers   Cisco, Mind Tree, Motorola, Ophio, Sony, TCS, Wipro,






what is data structure.in linear and non linear data structures which one is better?Explain

3 Answers   Wipro,


print pattern 1 1 33 33 555 555 77777777 555 555 33 33 1 1

1 Answers   Winit,


how to make a scientific calculater ?

0 Answers  


What is the use of define in c?

0 Answers  


What is malloc and calloc?

0 Answers  


What is function pointer c?

0 Answers  


Write a C/C++ program to add a user to MySQL. The user should be permitted to only "INSERT" into the given database

2 Answers   TCS, Unisys, Webyog,


Categories