Math, asked by zarkogammar, 2 months ago

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​

Answers

Answered by devarchanc
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