Need guidance and a lil programming puzzle (C)

cute.bandar

Cyborg Agent
These days I am trying to teach myself the C programming language.

So I found some puzzles for the C language that I am attempting to solve. Link!

Try to do puzzle number B06

Here is the question for those to lazy to click:
Write a function int randInt(int min, int max) that returns a random integer in the range min..max (inclusive).
to solve this you can only use the rand() function from the standard library.

My questions to you people are :

1. without looking at the answer or without knowing the answer previously how many of you can do this ? how difficult is this question ?
2. The way I see it , the question is more about maths than programming.(or is programming all about maths ? ) , so how important really is it to get this right ?

cya
 

Liverpool_fan

Sami Hyypiä, LFC legend
1. without looking at the answer or without knowing the answer previously how many of you can do this ? how difficult is this question ?
I couldn't. Using Modulo to get the largest number is kind of weird but makes sense.
2. The way I see it , the question is more about maths than programming.(or is programming all about maths ? ) , so how important really is it to get this right ?
You don't have to get it right all the time. What are experiences for then?
 
OP
cute.bandar

cute.bandar

Cyborg Agent
thanks for the support guys. I got so upset about not being able to do a (supposedly?) simple question that the solution is burned inside my head now ..
 
Top Bottom