Finding a number multiplication of 8 with out using
arithmetic operator
Answers were Sorted based on User's Feedback
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 |
Answer / lloyd.tumulak
boolean div8(x){
return (x & 7)
}
if return is 0 = divisible by 8
Is This Answer Correct ? | 3 Yes | 1 No |
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 |
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 |
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 |
main() { main(); }
pls anyone can help me to write a code to print the values in words for any value.Example:1034 to print as "one thousand and thirty four only"
plz send me all data structure related programs
Write a C program to add two numbers before the main function is called.
How to read a directory in a C program?
Design an implement of the inputs functions for event mode
#if something == 0 int some=0; #endif main() { int thing = 0; printf("%d %d\n", some ,thing); }
program to Reverse a linked list
12 Answers Aricent, Microsoft, Ness Technologies,
main() { int i=400,j=300; printf("%d..%d"); }
#define prod(a,b) a*b main() { int x=3,y=4; printf("%d",prod(x+2,y-1)); }
main() { int i=5; printf("%d%d%d%d%d%d",i++,i--,++i,--i,i); }
Write a program that find and print how many odd numbers in a binary tree