Two doubts about C for my project

This is a discussion on Two doubts about C for my project within the C Programming forums, part of the General Programming Boards category; Can anyone help me in a project i'm working, Two doubts: 1 ) i need to do a function like, ...

  1. #1
    Registered User
    Join Date
    Oct 2004
    Posts
    6

    Two doubts about C for my project

    Can anyone help me in a project i'm working,

    Two doubts:

    1 ) i need to do a function like, int sum(int x, int y), that return the sum of digits in representation of n in base b.

    2 ) I need to do a function like int prime(int x), wich return 1 if int x is prime, or 0 if int x is not prime.


    thank u very much

  2. #2
    Registered User
    Join Date
    Sep 2004
    Posts
    719
    1) read up on radix conversions
    2) mod each number from 2 up to int(x/2+1)..if x % n == 0 return 0

    (x/2 for optimization; +1 just in case)
    Last edited by misplaced; 10-11-2004 at 03:12 PM.

  3. #3
    ATH0 quzah's Avatar
    Join Date
    Oct 2001
    Posts
    14,826
    Search the forum for prime numbers. Search google for prime numbers. This topic comes up all the time. A few seconds searching should give you plenty of information on it.

    Other than that, go read the Announcements, and you'll soon find that you need to make some attempt at @#&)(*@()@$&(@*)(....

    Quzah.
    Hope is the first step on the road to disappointment.

  4. #4
    Lead Moderator kermi3's Avatar
    Join Date
    Aug 1998
    Posts
    2,595
    I'm am posting this because it appears that you are posting a homework assignment or other project and you are asking for someone else to do all of the work.

    Please don't ask people to do all your work for you, See the announcement on Homework at the top of the forum to see what is acceptable or PM me.

    Basically people are happy to help, but they're not going to do it all for you.

    Show us what you've got, show your code (using code tags), or where you're confused and someone will be happy to help you I'm sure. If it's something that you absolutely don't understand how it works, like you have no clue how qsort works, then ask a general question about the function and I'm sure someone will explain it. Though they may not give you all of the code for it, but someone will explain the concept.

    On obivous homework questions especially, I also like to remind people of the board's tenth guildeline, while this board is very helpful to people, make sure you have your instructor's permission before seeking help on assignments. While people on these boards are more than happy to help, we discourage people from asking for help on graded work without the instructor's permission, and we claim no repsonsibilty for any cheating or honor violations.

    Feel free to PM me with any questions.

    Good Luck,

    Kermi3
    Lead Moderator
    Kermi3

    If you're new to the boards, welcome and reading this will help you get started.
    Information on code tags may be found here

    - Sandlot is the highest form of sport.

  5. #5
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    32,822
    We need a new homework policy.
    Post another message showing some actual effort on your part.
    If you dance barefoot on the broken glass of undefined behaviour, you've got to expect the occasional cut.
    If at first you don't succeed, try writing your phone number on the exam paper.
    I support http://www.ukip.org/ as the first necessary step to a free Europe.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Problem Displaying a Struct
    By rockstarpirate in forum C++ Programming
    Replies: 16
    Last Post: 05-05-2008, 10:05 AM
  2. added start menu crashes game
    By avgprogamerjoe in forum Game Programming
    Replies: 6
    Last Post: 08-29-2007, 02:30 PM
  3. Dynamic Binding
    By gpr1me in forum C++ Programming
    Replies: 1
    Last Post: 03-24-2006, 09:01 AM
  4. Game Independent Anti-cheat Project Needs Programmers
    By GIA Project Lea in forum Projects and Job Recruitment
    Replies: 3
    Last Post: 09-15-2005, 08:41 PM

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21