Thread: how do I indicate the variable of greatest numerical value?

  1. #1
    Registered User
    Join Date
    Mar 2016
    Posts
    3

    Question how do I indicate the variable of greatest numerical value?

    Make a program that asks for two numbers to the user and print the largest. ( in C)

  2. #2
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    What have you tried? Post your attempt (in code tags) and tell us specifically where you're having trouble.

  3. #3
    Registered User
    Join Date
    Mar 2016
    Posts
    3
    #include <stdio.h>
    Main() {
    Int X;
    Y;
    Printf("write the two numbers:");
    Scanf("%d %d",&x,&y);

    Sorry if have something wrong, i'm beginner. At thus point i don't now how to indicate the largest number!

  4. #4
    Programming Wraith GReaper's Avatar
    Join Date
    Apr 2009
    Location
    Greece
    Posts
    2,739
    Maybe you should start with a simpler program, such as "hello world". Here is a version of it:
    Code:
    #include <stdio.h>
    
    int main(void)
    {
        printf("Hello World!\n");
        getchar();
    
        return 0;
    }
    Get an IDE such as CodeBlocks, compile and run the above example and see what it does. Try to change bits of it and observe the differences in execution or the errors. Also, take note of the indentation, clear code is essential.
    Devoted my life to programming...

  5. #5
    Registered User
    Join Date
    Jun 2011
    Posts
    4,513
    Please post code in code tags (as I linked above, see the red text), and be sure the basic syntax is correct (hint: C is case sensitive). You should add a line to print the two numbers you read, and ensure the code compiles and runs as expected, before moving on to the next step.

    Have you learned how to have your code make a decision yet?

  6. #6
    Registered User
    Join Date
    Mar 2016
    Posts
    3
    I started learning the language c the short time n have much practice yet, but thanks for the tips.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Greatest Multiple
    By JohnRaphael in forum C Programming
    Replies: 4
    Last Post: 02-24-2016, 07:00 AM
  2. Saving the greatest/ least value...
    By mcweezle in forum C++ Programming
    Replies: 16
    Last Post: 11-12-2006, 07:34 PM
  3. Greatest Artwork Ever
    By the dead tree in forum A Brief History of Cprogramming.com
    Replies: 28
    Last Post: 01-28-2005, 06:53 PM
  4. The Greatest Musician Ever.
    By Cheeze-It in forum A Brief History of Cprogramming.com
    Replies: 4
    Last Post: 06-25-2003, 05:20 PM
  5. Greatest C++ Doubt
    By vasanth in forum C++ Programming
    Replies: 15
    Last Post: 02-28-2002, 04:41 AM

Tags for this Thread