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() { 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
program to find magic aquare using array
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]); }
main() { int i = 3; for (;i++=0;) printf(“%d”,i); }
plz send me all data structure related programs
Which version do you prefer of the following two, 1) printf(“%s”,str); // or the more curt one 2) printf(str);
main() { extern out; printf("%d", out); } int out=100;
main() { int i=_l_abc(10); printf("%d\n",--i); } int _l_abc(int i) { return(i++); }
#include<stdio.h> main() { char s[]={'a','b','c','\n','c','\0'}; char *p,*str,*str1; p=&s[3]; str=p; str1=s; printf("%d",++*p + ++*str1-32); }
main() { int i=4,j=7; j = j || i++ && printf("YOU CAN"); printf("%d %d", i, j); }
Write a Program in 'C' To Insert a Unique Number Only. (Hint: Just Like a Primary Key Numbers In Database.) Please Some One Suggest Me a Better Solution for This question ??
Given an array of characters which form a sentence of words, give an efficient algorithm to reverse the order of the words (not characters) in it.