Howdy, Stranger!

It looks like you're new here. If you want to get involved, click one of these buttons!

Categories

HELP: rounding integers up!!!!!

stork33stork33 Member Posts: 2
say my code is this:
.
.
.
.
cream = (shcream + scream + ccream)/32;



where every variable is an int, how would i get the answer to always round up to the next whole number. like if the answer was 0 (in integer division) how would i get it to equal 1 ?

Comments

  • pghpgh Member Posts: 1
    cream = (shcream + scream + ccream)/32 + 1;

  • quagsirequagsire Member Posts: 37
    #include

    cream = floor( (shcream + scream + ccream)/32.0f + 0.5 );

  • Andre YoungAndre Young USAMember Posts: 0

    _________ { http://forcoder.org } free video tutorials and ebooks about / JavaScript MATLAB Java Delphi C# Swift Perl PHP Assembly PL/SQL C++ C Visual Basic .NET Objective-C R Visual Basic Ruby Python Scratch Go Apex Bash Dart Logo ML Awk F# Kotlin VBScript ABAP SAS Alice Crystal Erlang D Julia Fortran Transact-SQL Scheme Rust Lua Clojure Hack Scala Lisp COBOL Prolog LabVIEW Ada FoxPro / ____________

Sign In or Register to comment.