Forum     

Go Back   Digit Technology Discussion Forum > Software > Programming
Register FAQ Calendar Mark Forums Read

Programming The destination for developers - C, C++, Java, Python and the lot


Reply
 
LinkBack Thread Tools Display Modes
Old 20-12-2010, 09:50 PM   #1 (permalink)
In The Zone
 
cute.bandar's Avatar
 
Join Date: Jan 2010
Posts: 408
Default Need guidance and a lil programming puzzle (C)


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:
Quote:
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
cute.bandar is offline   Reply With Quote
Advertisements. Register and be a member of the community to get rid of them.
Advertisement

Old 20-12-2010, 11:42 PM   #2 (permalink)
Alpha Geek
 
Join Date: Jan 2007
Location: In your hearts
Posts: 828
Default Re: Need guidance and a lil programming puzzle (C)

its pretty easy yaar!!
yup its all about maths.
try it.
also may include some if statements!!
abhijangda is offline   Reply With Quote
Old 21-12-2010, 12:01 AM   #3 (permalink)
In The Zone
 
cute.bandar's Avatar
 
Join Date: Jan 2010
Posts: 408
Default Re: Need guidance and a lil programming puzzle (C)

Quote:
its pretty easy yaar!!
then it seems I am an idiot for not being able to do this
cute.bandar is offline   Reply With Quote
Old 21-12-2010, 04:25 AM   #4 (permalink)
Sami Hyypiä, LFC legend
 
Liverpool_fan's Avatar
 
Join Date: Jun 2007
Location: Нью-Дели
Posts: 2,138
Default Re: Need guidance and a lil programming puzzle (C)

Quote:
Originally Posted by cute.bandar View Post
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.
Quote:
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?
__________________
Experience true education in Computer Science - http://www.udacity.com | http://www.coursera.org

Spoiler:
Read before asking / messaging any moderator for any query: FAQ + answers for new members

Read all the sticky threads before asking any type of query. Most basic questions are answered in those.
Don't use forum for chatting. Visit http://webchat.freenode.net/?channels=krow, enter nick and connect.
Liverpool_fan is offline   Reply With Quote
Old 21-12-2010, 07:41 AM   #5 (permalink)
Human Spambot
 
Join Date: Nov 2004
Location: Madurai
Posts: 2,349
Default Re: Need guidance and a lil programming puzzle (C)

its basically the same as puzzle b03 with non-zero lower limit and a variable range...

Arun
sakumar79 is offline   Reply With Quote
Old 21-12-2010, 03:24 PM   #6 (permalink)
Alpha Geek
 
Join Date: Jan 2007
Location: In your hearts
Posts: 828
Default Re: Need guidance and a lil programming puzzle (C)

Quote:
Originally Posted by cute.bandar View Post
then it seems I am an idiot for not being able to do this
Nope it doesn't means that!!
Be +ve and just think how to do that, u will get the answer!!:-P
abhijangda is offline   Reply With Quote
Old 21-12-2010, 07:33 PM   #7 (permalink)
In The Zone
 
cute.bandar's Avatar
 
Join Date: Jan 2010
Posts: 408
Default Re: Need guidance and a lil programming puzzle (C)

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 ..
cute.bandar is offline   Reply With Quote
Reply

Bookmarks

Thread Tools
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On


 
Latest Threads
- by Charan
- by Charan

Advertisement




All times are GMT +5.5. The time now is 03:24 AM.


Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2012, vBulletin Solutions, Inc.

Search Engine Optimization by vBSEO 3.3.2