Thread: C Program help

  1. #1
    Registered User
    Join Date
    Mar 2020
    Posts
    1

    C Program help

    I have the following problem that I need help with.

    Code:
    #include <stdio.h>
    
    int doubled(int number);
    int tripled(int number);
    
    // TODO - Fix the program to print the correct values
    //        using the functions provided
    // TODO - Replace the following with your name: <student name>
    int main()
    {
        int x, xx, xxx = 0;
        x = 12;
    
        printf("%d doubled is: %d \n", x, xx);
        printf("%d tripled is: %d \n", x, xxx);
    
        return 0;
    }
    
    // TODO - Fix this function to return the correct value
    // returns double the number sent in
    int doubled(int number)
    {
        return 0;
    }
    
    // TODO - Fix this function to return the correct value
    // returns triple the number sent in
    int tripled(int number)
    {
        return 0;
    }
    Any and all help is appreciated.

  2. #2
    Registered User rstanley's Avatar
    Join Date
    Jun 2014
    Location
    New York, NY
    Posts
    706
    I could do the programming for you, but your instructor should have given you enough information to be able to create functions, how to call them, and return values.

    If this assignment is from a book or somewhere online, you need to go back and study the chapters of a good book on the C Programming Language, cover to cover, and do all the exercises at the end of each chapter! Choose one of the three listed below:

    C Programming, A Modern Approach
    Author: K. N. King

    C Primer Plus, 6th Edition
    Stephen Prata

    C How to Program, 8/e
    Deitel & Deitel

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Replies: 1
    Last Post: 01-25-2020, 05:06 PM
  2. Replies: 5
    Last Post: 03-15-2016, 03:29 PM
  3. Replies: 7
    Last Post: 03-15-2016, 06:35 AM
  4. Replies: 2
    Last Post: 09-09-2014, 02:36 PM
  5. Replies: 1
    Last Post: 03-03-2009, 04:47 PM

Tags for this Thread