Hello,

I am working on a program, which needs to output numbers rounded in a certain way. In this program, a number needs to be read in and divided by a constant of the data type double. The constant is 3.78.

So, for example if the input number is 9000, 9000 / 3.78 = 2380.952. I need this number to be output as an integer. If I set the output variable as an integer, the program round and would output 2380. But I need the number rounded up, which would be 2381. Another example is, 100 / 3.78 = 26.455, which should be output as 27. Basically any number that has a decimal part, I need it rounded up. I can¡¯t find any way to do that. The only way I can think of is by using if statements. Something like:

If (num has decimal part)

then convert to int and add 1

else

convert to int

However, I can't use an if statement (no loops either), because this is a school excercise which has some restrictions. I have finished the exercise, except for this part. This is the only part I can't figure out

Can somebody please help

Thanks in advance.