# HackerRank Beautiful Days at the Movies problem solution

In this HackerRank Beautiful Days at the Movies problem you have Given a range of numbered days, [i...j]  and a number k, to determine the number of days in the range that are beautiful. Beautiful numbers are defined as numbers where |i-reverse(i)|  is evenly divisible by k. If a day's value is a beautiful number, it is a beautiful day. Return the number of beautiful days in the range.

## Problem solution in Python programming.

```a, b, k = map(int, raw_input().split())
ans = 0
for i in range(a, b+1):
ans = ans + abs(not (i - int(str(i)[::-1]))%k)
print ans```

## Problem solution in Java Programming.

```import java.io.*;
import java.util.*;
import java.text.*;
import java.math.*;
import java.util.regex.*;

public class Solution {

public static void main(String[] args) {
/* Enter your code here. Read input from STDIN. Print output to STDOUT. Your class should be named Solution. */
Scanner in = new Scanner(System.in);
int i = in.nextInt();
int j = in.nextInt();
int k = in.nextInt();
int count = 0;

for (int a=i;j>a; a++){
StringBuilder temp = new StringBuilder();
temp.append(a);
temp=temp.reverse();
String temp1 = temp.toString();
int aRev = Integer.parseInt(temp1);
if(Math.abs((a-aRev)%k)==0){
count++;
}
}

System.out.println(count);
}
}```

### Problem solution in C++ programming.

```#include <iostream>

using namespace std;

bool isOk(int x, int mod) {
int n = x;
int m = 0;
while (x > 0) {
m = m * 10 + x % 10;
x /= 10;
}
int delta = abs(n - m);
delta %= mod;
return (delta == 0);
}

int main() {
int l, r, k;
cin >> l >> r >> k;
int ans = 0;
for (int i = l; i <= r; i++) {
if (isOk(i, k)) {
++ans;
}
}
cout << ans << endl;
return 0;
}```

### Problem solution in C programming.

```#include<stdio.h>
int main()
{
int i=0,j=0,k=0,x=0,rem=0,sum=0,count=0;
scanf("%d%d%d",&i,&j,&k);
for(i;i<=j;i++)
{
x=i;
while(x!=0)
{
rem=x%10;
sum=(sum*10)+rem;
x=x/10;
}
if(abs(i-sum)%k==0)
count=count+1;
sum=0;
}
printf("%d",count);
return 0;
}```