write a program to input a no. and print is divisble by 5 or not
Answers
Answered by
0
Answer:
lower = int(input("Enter lower range limit:"))
upper = int(input("Enter upper range limit:"))
for i in range(lower, upper+1):
if((i%3==0) & (i%5==0)):
print(i)
Answered by
1
Answer:
#include <stdio.h>
int main()
{
int a;
printf("enter the number");
scanf("%d",&a);
if(a%5==0)
{
printf("the number is divisible by 5 ");
}
else {
printf("the number is not divisble by 5 ");
}
return 0;
}
Output:-
enter the number 15
the number is divisible by 5
Using conditional operator
#include <stdio.h>
int main()
{
int a;
printf("enter the number");
scanf("%d",&a);
(a % 5 == 0) ? printf("it is divisible") : printf(" it is not divisible");
return 0;
}
output:-
enter the number 6
it is not divisible
Similar questions