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 c=' ',x,convert(z); getc(c); if((c>='a') && (c<='z')) x=convert(c); printf("%c",x); } convert(z) { return z-32; }

1 Answers  


main() { if ((1||0) && (0||1)) { printf("OK I am done."); } else { printf("OK I am gone."); } } a. OK I am done b. OK I am gone c. compile error d. none of the above

5 Answers   HCL,


What is data _null_? ,Explain with code when u need to use it in data step programming ?

0 Answers   Abbott,


main() { int i; clrscr(); printf("%d", &i)+1; scanf("%d", i)-1; } a. Runtime error. b. Runtime error. Access violation. c. Compile error. Illegal syntax d. None of the above

1 Answers   HCL,


What is the difference between proc means and proc tabulate ? explain with a simple example when you have to use means or tabulate?

1 Answers  






code of a program in c language that ask a number and print its decremented and incremented number.. sample output: input number : 3 321123

1 Answers   HCL,


3) Int Matrix of certain size was given, We had few valu= es in it like this. =97=97=97=97=97=97=97=97=97=97=97 1 = | 4 | | 5 | &= nbsp; | 45 =97=97=97=97=97=97=97=97=97=97=97 &n= bsp; | 3 | 3 | 5 | = | 4 =97=97=97=97=97=97=97=97=97=97=97 34 |&nbs= p; 3 | 3 | | 12 | &= nbsp; =97=97=97=97=97=97=97=97=97=97=97 3 | &nbs= p; | 3 | 4 | = | 3 =97=97=97=97=97=97=97=97=97=97=97 3 | = ; | | | = ; 3 | =97=97=97=97=97=97=97=97=97=97=97 &= nbsp; | | 4 | = ; | 4 | 3 We w= ere supposed to move back all the spaces in it at the end. Note: = If implemented this prog using recursion, would get higher preference.

0 Answers   RoboSoft,


Write a routine to implement the polymarker function

0 Answers   TCS,


Given n nodes. Find the number of different structural binary trees that can be formed using the nodes.

16 Answers   Aricent, Cisco, Directi, Qualcomm,


#define DIM( array, type) sizeof(array)/sizeof(type) main() { int arr[10]; printf(“The dimension of the array is %d”, DIM(arr, int)); }

1 Answers  


void main() { int x,y=2,z; z=(z*=2)+(x=y=z); printf("%d",z); }

4 Answers  


main() { char string[]="Hello World"; display(string); } void display(char *string) { printf("%s",string); }

2 Answers   Wipro,


Categories