0
C++ round integer UP to the next multiple of 10
It's embarrassing but although there are so many related articles out there, I just don't get it. Let's say that I have int numbersSum. If it is 41, I want to get an int of 50 if it is 67 I want to get an int of 70 Only round up to the next multiple of 10 and store that value in an int variable! I tried ceil but it won't do it. Any suggestions? Thanks in advance! 🍺 PS: Rookie here 😊
3 Réponses
+ 6
@kurwius Haaaa That's awesome!
ok other one
#include <stdio.h>
#include <math.h>
int main(){
printf("%f",ceil(67.0/10)*10);
return 0;
}
0
worked great! thank you so much, guys! I used your code @Very_Hard ! 😁