Thread: A very new beginner seeking help

  1. #1
    Registered User
    Join Date
    Sep 2018

    A very new beginner seeking help

    My Questions:
    1. What am I doing wrong? No matter how long a number I input the output never exceeds 19.
    2. Why does it have to be "long long" for the integer. By trial and error I have found out that this is the only one that fits. (When I used float the output is always 46.)A very new beginner seeking help-screenshot-5-jpg

  2. #2
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    The edge of the known universe
    The maximum value for a signed long long integer is 9,223,372,036,854,775,807
    If you type in something a bit larger than that, it will just wrap around to being negative.
    Values will get smaller and smaller until you finally hit 18446744073709551616, at which point your integer will be zero.

    There are various "bignum" libraries, which would allow you to enter arbitrarily large integers, but I suspect for the purpose of this exercise, that would be out of scope.

    And no, floats will not help you here.
    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.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Seeking an Mentor
    By Reggie Green in forum C++ Programming
    Replies: 1
    Last Post: 10-29-2012, 01:06 AM
  2. seeking for exercises
    By smoking81 in forum Linux Programming
    Replies: 7
    Last Post: 09-14-2008, 06:46 PM
  3. Seeking Help x.x
    By xeno13 in forum C++ Programming
    Replies: 4
    Last Post: 02-08-2006, 12:34 AM
  4. Seeking your skills.
    By spiderweb in forum Projects and Job Recruitment
    Replies: 0
    Last Post: 11-14-2004, 03:23 PM
  5. Seeking C beginners.
    By blue17 in forum C Programming
    Replies: 72
    Last Post: 10-28-2002, 05:35 AM

Tags for this Thread