ALLInterview.com :: Home Page KalAajKal.com
 Advertise your Business Here     
Browse  |   Placement Papers  |   Company  |   Code Snippets  |   Certifications  |   Visa Questions
Post Question  |   Post Answer  |   My Panel  |   Search  |   Articles  |   Topics  |   ERRORS new
   Refer this Site  Refer This Site to Your Friends  Site Map  Bookmark this Site  Set it as your HomePage  Contact Us     Login  |  Sign Up                      
tip   To Refer this Site to Your Friends   Click Here
Google
 
Categories  >>  Code Snippets  >>  Programming Code  >>  C Code
 
 


 

 
 C Code interview questions  C Code Interview Questions
 C++ Code interview questions  C++ Code Interview Questions
 VC++ Code interview questions  VC++ Code Interview Questions
 Java Code interview questions  Java Code Interview Questions
 Dot Net Code interview questions  Dot Net Code Interview Questions
 Visual Basic Code interview questions  Visual Basic Code Interview Questions
 Programming Code AllOther interview questions  Programming Code AllOther Interview Questions
Question
Finding a number multiplication of 8 with out using 
arithmetic operator
 Question Submitted By :: Guest
I also faced this Question!!     Rank Answer Posted By  
 
  Re: Finding a number multiplication of 8 with out using arithmetic operator
Answer
# 1
i << 3
 
Is This Answer Correct ?    4 Yes 2 No
Wl
 
  Re: Finding a number multiplication of 8 with out using arithmetic operator
Answer
# 2
/*      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 ?    0 Yes 0 No
Splurgeop
 
 
 
  Re: Finding a number multiplication of 8 with out using arithmetic operator
Answer
# 3
i=n<<3;
 
Is This Answer Correct ?    1 Yes 0 No
Raghuram.A
 
  Re: Finding a number multiplication of 8 with out using arithmetic operator
Answer
# 4
boolean div8(x){
  return (x & 7)
}

if return is 0 = divisible by 8
 
Is This Answer Correct ?    0 Yes 0 No
Lloyd.tumulak
 
  Re: Finding a number multiplication of 8 with out using arithmetic operator
Answer
# 5
int i,n=1;
 i=n<<3
 
Is This Answer Correct ?    2 Yes 0 No
Ram
 
  Re: Finding a number multiplication of 8 with out using arithmetic operator
Answer
# 6
#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 1 No
Saravanan E
 
  Re: Finding a number multiplication of 8 with out using arithmetic operator
Answer
# 7
#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 1 No
Saravanan E , Ps Technologies,
 
  Re: Finding a number multiplication of 8 with out using arithmetic operator
Answer
# 8
#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 0 No
Aditya Raj
 

 
 
 
Other C Code Interview Questions
 
  Question Asked @ Answers
 
main() { char s[ ]="man"; int i; for(i=0;s[ i ];i++) printf("\n%c%c%c%c",s[ i ],*(s+i),*(i+s),i[s]); }  1
char inputString[100] = {0}; To get string input from the keyboard which one of the following is better? 1) gets(inputString) 2) fgets(inputString, sizeof(inputString), fp)  1
Print an integer using only putchar. Try doing it without using extra storage.  1
void main() { void *v; int integer=2; int *i=&integer; v=i; printf("%d",(int*)*v); }  1
# include<stdio.h> aaa() { printf("hi"); } bbb(){ printf("hello"); } ccc(){ printf("bye"); } main() { int (*ptr[3])(); ptr[0]=aaa; ptr[1]=bbb; ptr[2]=ccc; ptr[2](); }  1
main() { int i=-1; +i; printf("i = %d, +i = %d \n",i,+i); }  1
What is "far" and "near" pointers in "c"...?  3
Is this code legal? int *ptr; ptr = (int *) 0x400;  1
main() { char a[4]="HELL"; printf("%s",a); } Wipro1
How to return multiple values from a function?  4
how to delete an element in an array  1
main() { char i=0; for(;i>=0;i++) ; printf("%d\n",i); }  1
main( ) { char *q; int j; for (j=0; j<3; j++) scanf(“%s” ,(q+j)); for (j=0; j<3; j++) printf(“%c” ,*(q+j)); for (j=0; j<3; j++) printf(“%s” ,(q+j)); }  1
main( ) { int a[ ] = {10,20,30,40,50},j,*p; for(j=0; j<5; j++) { printf(“%d” ,*a); a++; } p = a; for(j=0; j<5; j++) { printf(“%d ” ,*p); p++; } }  1
void main() { if(~0 == (unsigned int)-1) printf(“You can answer this if you know how values are represented in memory”); }  1
void main() { int *mptr, *cptr; mptr = (int*)malloc(sizeof(int)); printf(“%d”,*mptr); int *cptr = (int*)calloc(sizeof(int),1); printf(“%d”,*cptr); }  1
#define clrscr() 100 main() { clrscr(); printf("%d\n",clrscr()); }  1
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
main() { unsigned int i=10; while(i-->=0) printf("%u ",i); }  1
main() { int i; clrscr(); for(i=0;i<5;i++) { printf("%d\n", 1L << i); } } a. 5, 4, 3, 2, 1 b. 0, 1, 2, 3, 4 c. 0, 1, 2, 4, 8 d. 1, 2, 4, 8, 16 HCL1
 
For more C Code Interview Questions Click Here 
 
 
 
 
 
   
Copyright Policy  |  Terms of Service  |  Help  |  Site Map 1  |  Articles  |  Site Map  |   Site Map  |  Contact Us interview questions urls   External Links 
   
Copyright © 2007  ALLInterview.com.  All Rights Reserved.

ALLInterview.com   ::  Forum9.com   ::  KalAajKal.com