Online Compiler C

#include <stdio.h> int main() { int N,K,b,c,length; scanf("%d %d",&N,&K); if(N>=0&&(K>=1&&K<=10)){ c=N/10; length=length+1; While(c!=0); length=length-1; if(length>=K){ for(int i=0;i<K;i++){ c=N/10; b=N%10; N=c; } printf("%d",b); }; }; return 0; }
1) This code attempts to find the K-th digit from the right of a number N, but contains several syntax and logic errors including an undefined variable and incorrect loop structure.

2) Hint 1: The variable 'length' is used without being initialized first - this will cause undefined behavior. You need to set it to an initial value before using it.

Hint 2: Check your while loop syntax - there's a semicolon in the wrong place that breaks the loop structure, and you need to actually modify 'c' inside the loop to avoid an infinite loop.