Thread: Please help, need user to decide how many decimal points to print.

Threaded View

Previous Post Previous Post   Next Post Next Post
  1. #1
    Registered User
    Join Date
    Sep 2017
    Posts
    2

    Please help, need user to decide how many decimal points to print.

    I am trying to have a user input a number, 5 for example, and then prints a number i have with that many decimal points.

    example:

    user types: 5

    prints: 1.10293

    (i chose random numbers here, but has 5 decimal points)

    I only know how to do this printf("%.5lf", mynumber);

    and that would print 5, but always 5.

    i want it to print the amount the user puts in.

    thank you for any help or advice
    Last edited by frezzy; 09-27-2017 at 09:53 PM.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Decimal points
    By rocksolid in forum C Programming
    Replies: 4
    Last Post: 02-01-2014, 03:27 PM
  2. aligning decimal points?
    By mp91 in forum C Programming
    Replies: 2
    Last Post: 01-28-2013, 08:30 AM
  3. Decimal Points and Binary Points
    By Shadow12345 in forum A Brief History of Cprogramming.com
    Replies: 9
    Last Post: 11-07-2002, 01:06 AM
  4. (C++) How to detect decimal points?
    By jeffcoulter in forum C++ Programming
    Replies: 6
    Last Post: 10-17-2002, 02:36 PM
  5. decimal points
    By canine in forum Windows Programming
    Replies: 1
    Last Post: 04-29-2002, 10:01 PM

Tags for this Thread