Question:
Write the equivalent expression for x%8?
Answer:
x&7 Source: CoolInterview.com
x-(8 * (x/8)) Source: CoolInterview.com
Answered by: unknown | Date: 3/17/2009
| Contact unknown
int a=0; int remainder=0; a=x/8; remainder=x-(a*8);
will give the same result as of x%8 Source: CoolInterview.com
Answered by: Rohit Kamthe | Date: 6/23/2009
| Contact Rohit Kamthe
int remainder=0; int i=0; i=x/8; remainder=x-(i*8);
this will give you the same output as x%8 Source: CoolInterview.com
Answered by: Rohit Kamthe | Date: 6/23/2009
| Contact Rohit Kamthe
Alternative expression: x&0x7(x bitwise and with 0x7) Source: CoolInterview.com
Answered by: Samy | Date: 10/2/2009
| Contact Samy
x % 8 = x & 7 Source: CoolInterview.com
Answered by: Manash | Date: 1/8/2010
| Contact Manash
the equivalent expression for x%8 is x-(x/8)*8 Source: CoolInterview.com
Answered by: karthik | Date: 1/26/2010
| Contact karthik
The correct answer is. main() { int reminder,y; y=x/8; reminder=x-(y*8); } Source: CoolInterview.com
Answered by: yagnesh | Date: 4/7/2010
| Contact yagnesh
Correct Answer Is
main() { int x; x=x-((x/8)*8); print("%d",x); } Source: CoolInterview.com
Answered by: Koustubh Mokashi | Date: 7/7/2010
| Contact Koustubh Mokashi
correct ans is #include<stdio.h> #include<conio.h> void main() { int remainder=0; int i=0; i=x/8; remainder=x-(i*8); } Source: CoolInterview.com
Answered by: satish patel | Date: 7/26/2010
| Contact satish patel
int x,d; //take any value for x and d; printf("Remainder=%d",r=x-(d*(x/d))); Source: CoolInterview.com
Answered by: viren | Date: 8/10/2010
| Contact viren
basically, we have to find remainder without using % operator,it will be...... main() { int a,b; printf("
enter the number="); scanf("%d%d",&a,&b); while(a-b>=b) { a=a-b; } printf("
remainder=%d",a-b); } Source: CoolInterview.com
Answered by: darshan | Date: 8/24/2010
| Contact darshan
#include<stdio.h> main() { int a,b; printf(" enter the number="); scanf("%d%d",&a,&b); while(a-b>=b) { a=a-b; } printf(" remainder=%d",b-a); } Source: CoolInterview.com
Answered by: krishnaprasad | Date: 9/6/2010
| Contact krishnaprasad
If you have the better answer, then send it to us. We will display your answer after the approval.
Rules to Post Answers in CoolInterview.com:-
- There should not be any Spelling Mistakes.
- There should not be any Gramatical Errors.
- Answers must not contain any bad words.
- Answers should not be the repeat of same answer, already approved.
- Answer should be complete in itself.
|