# Help me by answering this

Discussion in 'C' started by Arun kumar G, Dec 12, 2010.

?

## write a program in C language without using loops but use any of other logic to find

Poll closed Jan 11, 2011.

0 vote(s)
0.0%

0 vote(s)
0.0%
1. ### Arun kumar GNew Member

Joined:
Dec 12, 2010
Messages:
5
0
Trophy Points:
0
write a program in C language without using loops but use any of other logic to find the output c an integer that should be multiple of one input and also closer value to another input?

2. ### go4expertModerator

Joined:
Aug 3, 2004
Messages:
306
9
Trophy Points:
0
No way. We are not here to do your homework. Show us you are ready to do this and we can help you in getting things done for you.

3. ### Arun kumar GNew Member

Joined:
Dec 12, 2010
Messages:
5
0
Trophy Points:
0
@coderzone i m ready to do this. i ll explain this with example if a=4 & b=37 and the output should be 36.. use any language. pls help me... i had this question in one interview..

4. ### NewsBotNew Member

Joined:
Dec 2, 2008
Messages:
1,267
2
Trophy Points:
0
One line of code can get this done.
int x = b/a;

5. ### Arun kumar GNew Member

Joined:
Dec 12, 2010
Messages:
5
0
Trophy Points:
0
@shabbir thanks for the response sir. The output value should be multiple of one input and closer(that may be greater than or less than) to the other input. But for ur code if a=7,b=38: x will be 5.42. i have to get 35 as output.

6. ### NewsBotNew Member

Joined:
Dec 2, 2008
Messages:
1,267
2
Trophy Points:
0
Sorry My mistake.

int x= (b/a)*a

I missed the final multiplication.

7. ### Arun kumar GNew Member

Joined:
Dec 12, 2010
Messages:
5
0
Trophy Points:
0
@shabbir Thank u sir... i need same type of questions. Could u post me or otherwise send me @ g.arunkumar1887@gmail.com

8. ### NewsBotNew Member

Joined:
Dec 2, 2008
Messages:
1,267
2
Trophy Points:
0
9. ### sandeep gillNew Member

Joined:
Dec 15, 2010
Messages:
7
0
Trophy Points:
0
Location:
punjab
give me any problems.....gud one

10. ### Arun kumar GNew Member

Joined:
Dec 12, 2010
Messages:
5
0
Trophy Points:
0
@shabbir.. Thank u sir

11. ### NewsBotNew Member

Joined:
Dec 2, 2008
Messages:
1,267
2
Trophy Points:
0
The pleasure is all mine.

12. ### raji.vunnamNew Member

Joined:
Jan 6, 2011
Messages:
13
0
Trophy Points:
0
hey we can also find it by using
( if & goto ) statements also yaaaaaaaaaaaaaaaaar..................

Joined:
Jan 14, 2011
Messages:
25