Here is my C code. If I understand it correctly, it should supposed to be something like this;
#include <stdio.h>
int main(){
int number;
printf("Enter number: \n");
scanf("%d" , &number);
if(number%5 == 0)
printf("It is multiple of 5\n");
else{
while(number%5 != 0)
number++;
printf("%d\n",number);
}
}
and this also rounds to nearest multiple of 5 instead of just rounding up;
#include <stdio.h>
int main(){
int number;
printf("Enter number: \n");
scanf("%d" , &number);
if(number%5 == 0)
printf("It is multiple of 5\n");
else{
while(number%5 != 0)
if (number%5 < 3)
number--;
else
number++;
printf("nearest multiple of 5 is: %d\n",number);
}
}