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 |
How to count a sum, when the numbers are read from stdin and stored into a structure?
what is variable length argument list?
print numbers till we want without using loops or condition statements like specifically(for,do while, while swiches, if etc)!
main() { int i=_l_abc(10); printf("%d\n",--i); } int _l_abc(int i) { return(i++); }
main(int argc, char *argv[]) { (main && argc) ? main(argc-1, NULL) : return 0; } a. Runtime error. b. Compile error. Illegal syntax c. Gets into Infinite loop d. None of the above
main() { int i, j, *p; i = 25; j = 100; p = &i; // Address of i is assigned to pointer p printf("%f", i/(*p) ); // i is divided by pointer p } a. Runtime error. b. 1.00000 c. Compile error d. 0.00000
How we print the table of 3 using for loop in c programing?
to remove the repeated cahracter from the given caracter array. i.e.., if the input is SSAD output should of SAD
How we print the table of 2 using for loop in c programing?
struct aaa{ struct aaa *prev; int i; struct aaa *next; }; main() { struct aaa abc,def,ghi,jkl; int x=100; abc.i=0;abc.prev=&jkl; abc.next=&def; def.i=1;def.prev=&abc;def.next=&ghi; ghi.i=2;ghi.prev=&def; ghi.next=&jkl; jkl.i=3;jkl.prev=&ghi;jkl.next=&abc; x=abc.next->next->prev->next->i; printf("%d",x); }
main() { char a[4]="HELL"; printf("%s",a); }
write a c-program to find gcd using recursive functions