I am getting Floating Point Exception when i run this program on Linux.
#include<stdio.h>
#include<math.h>
int main()
{
int num, num1, num2, n, i, j = 0, t, count = 0;
int root;
printf("Enter number of test cases\n");
scanf("%d", &t);
while (j < t)
{
scanf("%d", &num);
root = (int)sqrt(num);
for (i = 1; i < root; i++)
{
printf("Inside for");
if (num % i == 0)
num1 = i;
while (num1 > 0)
{
n = num1 % 10;
num1 = num1 / 10;
if (n == 3 || n == 5 || n == 6)
count++;
}
if (num % num1 == 0)
{
num2 = (int)num / num1;
while (num2 > 0)
{
n = num2 % 10;
num2 = num2 / 10;
if (n == 3 || n == 5 || n == 6)
count++;
}
}
}
j++;
count = 0;
printf("%d", count);
}
return 0;
}
Can anyone please tell me how to correct it