I want to solve this problem.
There are 52735727364727372 students and 2889221271829121 teachers in a school . On children's day each teacher brings x toffees with him/her . All the toffees are collected and distributed equally to all the students . At the end it was found that there was exactly one toffee remaining .
What is the least possible value of x ?
I have the following code.
How do I handle large integers??
#include <iostream>
using namespace std;
int main()
{
int children = 52735727364727372;
int teachers = 2889221271829121;
int no_of_chocholates=1;
while(((no_of_chocholates*teachers)-1)%children!=0)
{
no_of_chocholates++;
}
cout<<no_of_chocholates;
return 0;
}