Finding a number multiplication of 8 with out using
arithmetic operator

Answers were Sorted based on User's Feedback



Finding a number multiplication of 8 with out using arithmetic operator..

Answer / wl

i << 3

Is This Answer Correct ?    9 Yes 2 No

Finding a number multiplication of 8 with out using arithmetic operator..

Answer / splurgeop

/* PROGRAM TO FIND WHETHER A NUMBER IS A MULTIPLE OF 2
AND 8 WITHOUT
USING ARITHMETIC OPERATOR */

#include<stdio.h>
#include<conio.h>
void main()
{
int num;
clrscr();
printf("\n enter a number");
scanf("%d",&num);
if(num & 1)
printf("\n not a multiple of 2");
else
printf("\n a multiple of 2");
if(num & 7)
printf("\n not a multiple of 8");
else
printf("\n a multiple of 8");

getch();
}

Is This Answer Correct ?    6 Yes 1 No

Finding a number multiplication of 8 with out using arithmetic operator..

Answer / raghuram.a

i=n<<3;

Is This Answer Correct ?    2 Yes 0 No

Finding a number multiplication of 8 with out using arithmetic operator..

Answer / lloyd.tumulak

boolean div8(x){
return (x & 7)
}

if return is 0 = divisible by 8

Is This Answer Correct ?    3 Yes 1 No

Finding a number multiplication of 8 with out using arithmetic operator..

Answer / ram

int i,n=1;
i=n<<3

Is This Answer Correct ?    3 Yes 1 No

Finding a number multiplication of 8 with out using arithmetic operator..

Answer / saravanan e

#include <stdio.h>
main()
{
int x,n;
printf("Enter the X number:");
scanf("%d",&x);
n=(x<<3)-x;
printf("The Answer is : %d",n);
getch();
}

Is This Answer Correct ?    2 Yes 2 No

Finding a number multiplication of 8 with out using arithmetic operator..

Answer / saravanan e , ps technologies,

#include <stdio.h>
main()
{
int x,n;
printf("Enter the X number:");
scanf("%d",&x);
n=(x<<3)-x;
printf("The Answer is : %d",n);
getch();
}

Is This Answer Correct ?    1 Yes 3 No

Finding a number multiplication of 8 with out using arithmetic operator..

Answer / aditya raj

#include<stdio.h>
main()
{
int n;
scanf("%d",&n);
if((n&7)==0) printf("yes\n");
else printf("no\n");
}

Is This Answer Correct ?    0 Yes 2 No

Post New Answer

More C Code Interview Questions

#include<stdio.h> main() { register i=5; char j[]= "hello"; printf("%s %d",j,i); }

2 Answers  


main( ) { void *vp; char ch = ‘g’, *cp = “goofy”; int j = 20; vp = &ch; printf(“%c”, *(char *)vp); vp = &j; printf(“%d”,*(int *)vp); vp = cp; printf(“%s”,(char *)vp + 3); }

1 Answers  


could you please send the program code for multiplying sparse matrix in c????

0 Answers  


main() { int k=1; printf("%d==1 is ""%s",k,k==1?"TRUE":"FALSE"); }

1 Answers  


To reverse an entire text file into another text file.... get d file names in cmd line

0 Answers   Subex,






main() { int i, j; scanf("%d %d"+scanf("%d %d", &i, &j)); printf("%d %d", i, j); } a. Runtime error. b. 0, 0 c. Compile error d. the first two values entered by the user

2 Answers   HCL,


Develop a routine to reflect an object about an arbitrarily selected plane

0 Answers  


void main() { static int i=i++, j=j++, k=k++; printf(“i = %d j = %d k = %d”, i, j, k); }

3 Answers  


main() { int c[ ]={2.8,3.4,4,6.7,5}; int j,*p=c,*q=c; for(j=0;j<5;j++) { printf(" %d ",*c); ++q; } for(j=0;j<5;j++){ printf(" %d ",*p); ++p; } }

1 Answers  


why is printf("%d %d %d",i++,--i,i--);

4 Answers   Apple, Cynity, TCS,


How do you create a really large matrix (i.e. 3500x3500) in C without having the program crash? I can only reach up to 2500. It must have something to do with lack of memory. Please help!

1 Answers  


main() { while (strcmp(“some”,”some\0”)) printf(“Strings are not equal\n”); }

1 Answers  


Categories