Getting SIGFPE runtime error (Not dividing by zero)

Hi I am new to codechef and competitive programming today i was solving this problem SPCANDY Problem - CodeChef and i submitted my code but i am getting SIGFPE runtime error i searched everywhere, i am not diving by zero but still this problem persists someone please help me to resolve this i am losing confidence :frowning:
here is my code

#include<stdio.h>

int main(void)
{

int one,two,n,k,t;
scanf("%d",&t);
while(t-- & k!=0)
{

	scanf("%d %d",&n,&k);

	one=n/k; 
	two=n%k;


printf("\n %d \t %d ",one,two );
}

return 0;

}

first you must initialize k with some with value otherwise your while never run if value of k=0 in some case …
and consider this test case
2
1 2
0 0
so when while loop is executing second time value of k is 2 previous value so in this case SIGFPE can occur so change your code use if statement .

thanks a lot man :slight_smile: i came to know what was my mistake should have used if statement, it works now ! Appreciate