+ 2
check multiple of 5
how can I write a code using c++ which accepts a number and rounds the number off to the next multiple of 5 example: user inputs 78 and it gets rounded off to 80. thank you.
4 Réponses
+ 10
https://code.sololearn.com/cagFjc4isv6r/?ref=app
I hope this helps.😆
+ 3
roundoff()
{
int i;
cout<<"Enter a number";
cin>>i;
if((i%5)!=0)
{
i+=(5-i%5);
return i;
}
else
return i;
}
//Now call this function from main()
+ 1
Use a loop and for checking the multiple => modulus operator "%"
+ 1
thank you for your answers really helped me