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

How to count a sum, when the numbers are read from stdin and stored into a structure?

1 Answers  


what is variable length argument list?

2 Answers  


print numbers till we want without using loops or condition statements like specifically(for,do while, while swiches, if etc)!

11 Answers   Wipro,


main() { int i=_l_abc(10); printf("%d\n",--i); } int _l_abc(int i) { return(i++); }

2 Answers  


main(int argc, char *argv[]) { (main && argc) ? main(argc-1, NULL) : return 0; } a. Runtime error. b. Compile error. Illegal syntax c. Gets into Infinite loop d. None of the above

4 Answers   HCL, LG,






main() { int i, j, *p; i = 25; j = 100; p = &i; // Address of i is assigned to pointer p printf("%f", i/(*p) ); // i is divided by pointer p } a. Runtime error. b. 1.00000 c. Compile error d. 0.00000

3 Answers   HCL,


How we print the table of 3 using for loop in c programing?

7 Answers  


to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD

6 Answers   Synergy,


How we print the table of 2 using for loop in c programing?

14 Answers   HCL, Wipro,


struct aaa{ struct aaa *prev; int i; struct aaa *next; }; main() { struct aaa abc,def,ghi,jkl; int x=100; abc.i=0;abc.prev=&jkl; abc.next=&def; def.i=1;def.prev=&abc;def.next=&ghi; ghi.i=2;ghi.prev=&def; ghi.next=&jkl; jkl.i=3;jkl.prev=&ghi;jkl.next=&abc; x=abc.next->next->prev->next->i; printf("%d",x); }

1 Answers  


main() { char a[4]="HELL"; printf("%s",a); }

3 Answers   Wipro,


write a c-program to find gcd using recursive functions

5 Answers   HTC, Infotech,


Categories