plz someone help me with this program
Write a program to accept a number and find out the given number is divisible by 5 or not. If not then print the nearest higher number from the given number which is divisible by 5(15 is the nearest
a higher number for 11)
Answers
Answered by
1
Language:
Python
Program:
n=int(input())
if n%5==0:
print("Divisible by 5")
else:
m=n//5
print((m+1)*5)
Logic:
- take an input for n, if n not divisible by 5 then take the quotient and multiply the quotient +1 to 5 to get next closer multiple of 5.
Answered by
0
Programming
Step-by-step explanation:
C++ programming
#include <stdio.h>
int main()
{
int num,i;
printf("Enter any number: ");
scanf("%d", &num);
if(num%5==0)
{
printf("Number is divisible by 5");
}
else
{
printf("Number is not divisible by 5");
for(i=num;i>0;i++)
{
num++;
if(num % 5 == 0)
{
printf(" The nearest higher number from the given number which is divisible by 5 is %d", num);
break;
}
}
}
}
Similar questions
Math,
1 month ago
English,
1 month ago
Hindi,
1 month ago
Hindi,
2 months ago
Social Sciences,
9 months ago