Thread: Width Modifier for End User Input

  1. #1
    Registered User
    Join Date
    Sep 2013
    Location
    West Lafayette, Indiana, United States
    Posts
    1

    Width Modifier for End User Input

    First of all I'm a beginner. So I'm probably asking a really stupid question.

    I have created a program to calculate different measurements for a cylinder. Anyways, the end user has to input 3 variables.

    Enter the lower radius: 6
    Enter the upper radius: 5
    Enter slant height: 2.236

    The numbers are what "End User" would input. But I need to make it look like this when said "End User inputs the numbers.

    Enter the lower radius: 6
    Enter the upper radius: 5
    Enter slant height: 2.236

    Here is what I have for it, but I don't know what to put where.

    printf("\nEnter the lower radius: ");
    scanf("%f", &lower_rad);
    printf("Enter the upper radius: ");
    scanf("%f", &upper_rad);
    printf("Enter slant height: ");
    scanf("%f", &slant_h);


    Thanks!

  2. #2
    Registered User
    Join Date
    Jan 2011
    Posts
    144
    Not sure if I understand your question. That code seems to work fine.

    Code:
    #include <stdio.h>
    
    int main()
    {
        float lower_rad, upper_rad, slant_h;
    
        printf("\nEnter the lower radius: ");
        scanf("%f", &lower_rad);
        printf("Enter the upper radius: ");
        scanf("%f", &upper_rad);
        printf("Enter slant height: ");
        scanf("%f", &slant_h);
    
        getchar();getchar();
        return 0;
    }

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. i need help with getting input from the user.
    By nyekknyakk in forum C Programming
    Replies: 7
    Last Post: 08-17-2010, 10:22 PM
  2. Replies: 9
    Last Post: 07-21-2009, 08:52 PM
  3. User Input
    By SirCrono6 in forum C++ Programming
    Replies: 6
    Last Post: 11-24-2003, 01:03 AM
  4. user input
    By hen in forum C Programming
    Replies: 4
    Last Post: 06-29-2002, 04:10 PM
  5. user input
    By hen in forum C Programming
    Replies: 16
    Last Post: 06-27-2002, 11:09 PM

Tags for this Thread