Thread: Is the round() only executed in the loop ?

  1. #1
    Registered User
    Join Date
    Sep 2019
    Posts
    6

    Is the round() only executed in the loop ?

    Is the round() only executed in the loop ?-capture-jpg

    Is the round() only executed in the loop ?-capture1-jpg

  2. #2
    Registered User
    Join Date
    Sep 2019
    Posts
    6
    Quarters evaluates to 1. but, 41 / 25 = 1.6

    Is it being rounded down to 1 ? seems to me that the round() only executes in the loop.

  3. #3
    Registered User
    Join Date
    May 2009
    Posts
    4,183
    Lookup integer division
    "...a computer is a stupid machine with the ability to do incredibly smart things, while computer programmers are smart people with the ability to do incredibly stupid things. They are,in short, a perfect match.." Bill Bryson

  4. #4
    and the hat of int overfl Salem's Avatar
    Join Date
    Aug 2001
    Location
    The edge of the known universe
    Posts
    39,659
    In future, please post your code and other machine generated text between [code][/code] tags.

    We can't (for example), easily quote your picture to highlight particular issues.

    Fuzzy pictures are a high bandwidth, low quality proxy.
    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.

  5. #5
    misoturbutc Hodor's Avatar
    Join Date
    Nov 2013
    Posts
    1,787
    Yes, round() is only executed in the loop.

Popular pages Recent additions subscribe to a feed

Similar Threads

  1. Code after while loop not being executed
    By dan108 in forum C Programming
    Replies: 8
    Last Post: 09-07-2013, 07:05 AM
  2. Extra loop being executed in do-while loop.
    By Krabiki in forum C Programming
    Replies: 9
    Last Post: 07-03-2013, 10:17 PM
  3. (Community Game) Round Robin for C++ [Round 01]
    By phantomotap in forum General Discussions
    Replies: 5
    Last Post: 04-18-2011, 01:07 PM
  4. (Community Game) Planning for Round Robin for C++ [Round 02]
    By phantomotap in forum General Discussions
    Replies: 2
    Last Post: 04-17-2011, 02:39 PM
  5. spontaneous round-off type error in loop
    By jdmikros in forum C Programming
    Replies: 4
    Last Post: 06-04-2003, 10:47 AM

Tags for this Thread