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

main() { char p[ ]="%d\n"; p[1] = 'c'; printf(p,65); }

2 Answers  


main() { int i; float *pf; pf = (float *)&i; *pf = 100.00; printf("\n %d", i); } a. Runtime error. b. 100 c. Some Integer not 100 d. None of the above

2 Answers   HCL, LG,


Derive expression for converting RGB color parameters to HSV values

1 Answers  


enum colors {BLACK,BLUE,GREEN} main() { printf("%d..%d..%d",BLACK,BLUE,GREEN); return(1); }

2 Answers  


struct Foo { char *pName; }; main() { struct Foo *obj = malloc(sizeof(struct Foo)); clrscr(); strcpy(obj->pName,"Your Name"); printf("%s", obj->pName); } a. Your Name b. compile error c. Name d. Runtime error

3 Answers   HCL,






What is the hidden bug with the following statement? assert(val++ != 0);

1 Answers  


main() { char *p; p="Hello"; printf("%c\n",*&*p); }

1 Answers  


respected sir, i did my MCA in 2013 when i am going to attend to an interview i was asked about my project how will i explain my project could please help me in this and my project title is "Social Networking Site For Social Responsibility"

1 Answers   Genpact, Ozdocs,


void main() { int const * p=5; printf("%d",++(*p)); }

3 Answers   Infosys, Made Easy, State Bank Of India SBI,


void main() { char ch; for(ch=0;ch<=127;ch++) printf(ā€œ%c %d \nā€œ, ch, ch); }

1 Answers  


Write a program using one dimensional array to assign values and then display it on the screen. Use the formula a[i]=i*10 to assign value to an element.

1 Answers   Samar State University,


Write a program that reads a dynamic array of 40 integers and displays only even integers

2 Answers  


Categories