How should I round up a number in c#? | Sololearn: Learn to code for FREE!
Nowy kurs! Każdy programista powinien nauczyć się Generative AI!
Wypróbuj darmową lekcję
0

How should I round up a number in c#?

I tried number += (1 - ( number % 1 )) ; But doesnt work for whole numbers.

11th Jan 2020, 8:28 AM
Mehran.S
1 Odpowiedź
+ 2
Smart logic.. BTW for whole numbers means how? Can give example? Is you want it without use of round, ceil functions..? Math.Ceiling (number) ; //rounds up value....
11th Jan 2020, 9:31 AM
Jayakrishna 🇮🇳